@@ -89,6 +89,11 @@ static inline bool is_var_type(zend_uchar type) {
89
89
return (type & (IS_CV |IS_VAR |IS_TMP_VAR )) != 0 ;
90
90
}
91
91
92
+ static inline bool is_defined (const zend_ssa * ssa , const zend_op_array * op_array , int var ) {
93
+ const zend_ssa_var * ssa_var = & ssa -> vars [var ];
94
+ return ssa_var -> definition >= 0 || ssa_var -> definition_phi || var < op_array -> last_var ;
95
+ }
96
+
92
97
#define FAIL (...) do { \
93
98
if (status == SUCCESS) { \
94
99
fprintf(stderr, "\nIn function %s::%s (%s):\n", \
@@ -209,6 +214,10 @@ void ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ex
209
214
if (ssa_op -> op1_use >= ssa -> vars_count ) {
210
215
FAIL ("op1 use %d out of range\n" , ssa_op -> op1_use );
211
216
}
217
+ if (!is_defined (ssa , op_array , ssa_op -> op1_use )) {
218
+ FAIL ("op1 use of " VARFMT " in " INSTRFMT " is not defined\n" ,
219
+ VAR (ssa_op -> op1_use ), INSTR (i ));
220
+ }
212
221
if (!is_in_use_chain (ssa , ssa_op -> op1_use , i )) {
213
222
FAIL ("op1 use of " VARFMT " in " INSTRFMT " not in use chain\n" ,
214
223
VAR (ssa_op -> op1_use ), INSTR (i ));
@@ -222,6 +231,10 @@ void ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ex
222
231
if (ssa_op -> op2_use >= ssa -> vars_count ) {
223
232
FAIL ("op2 use %d out of range\n" , ssa_op -> op2_use );
224
233
}
234
+ if (!is_defined (ssa , op_array , ssa_op -> op2_use )) {
235
+ FAIL ("op2 use of " VARFMT " in " INSTRFMT " is not defined\n" ,
236
+ VAR (ssa_op -> op2_use ), INSTR (i ));
237
+ }
225
238
if (!is_in_use_chain (ssa , ssa_op -> op2_use , i )) {
226
239
FAIL ("op2 use of " VARFMT " in " INSTRFMT " not in use chain\n" ,
227
240
VAR (ssa_op -> op2_use ), INSTR (i ));
@@ -235,6 +248,10 @@ void ssa_verify_integrity(zend_op_array *op_array, zend_ssa *ssa, const char *ex
235
248
if (ssa_op -> result_use >= ssa -> vars_count ) {
236
249
FAIL ("result use %d out of range\n" , ssa_op -> result_use );
237
250
}
251
+ if (!is_defined (ssa , op_array , ssa_op -> result_use )) {
252
+ FAIL ("result use of " VARFMT " in " INSTRFMT " is not defined\n" ,
253
+ VAR (ssa_op -> result_use ), INSTR (i ));
254
+ }
238
255
if (!is_in_use_chain (ssa , ssa_op -> result_use , i )) {
239
256
FAIL ("result use of " VARFMT " in " INSTRFMT " not in use chain\n" ,
240
257
VAR (ssa_op -> result_use ), INSTR (i ));
0 commit comments