diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index 7eb2bffbcaf..2d6fc13713e 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -724,7 +724,7 @@ static void zend_do_free(znode *op1) /* {{{ */ case ZEND_POST_DEC: /* convert $i++ to ++$i */ opline->opcode -= 2; - opline->result_type = IS_UNUSED; + SET_UNUSED(opline->result); return; case ZEND_ASSIGN: case ZEND_ASSIGN_DIM: @@ -740,7 +740,7 @@ static void zend_do_free(znode *op1) /* {{{ */ case ZEND_PRE_DEC_OBJ: case ZEND_PRE_INC: case ZEND_PRE_DEC: - opline->result_type = IS_UNUSED; + SET_UNUSED(opline->result); return; } } @@ -757,10 +757,8 @@ static void zend_do_free(znode *op1) /* {{{ */ && opline->result.var == op1->u.op.var) { if (opline->opcode == ZEND_FETCH_THIS) { opline->opcode = ZEND_NOP; - opline->result_type = IS_UNUSED; - } else { - opline->result_type = IS_UNUSED; } + SET_UNUSED(opline->result); } else { while (opline >= CG(active_op_array)->opcodes) { if ((opline->opcode == ZEND_FETCH_LIST_R || @@ -5103,11 +5101,11 @@ void zend_resolve_goto_label(zend_op_array *op_array, zend_op *opline) /* {{{ */ } opline->opcode = ZEND_JMP; - opline->op1.opline_num = dest->opline_num; - opline->extended_value = 0; SET_UNUSED(opline->op1); SET_UNUSED(opline->op2); SET_UNUSED(opline->result); + opline->op1.opline_num = dest->opline_num; + opline->extended_value = 0; ZEND_ASSERT(remove_oplines >= 0); while (remove_oplines--) { @@ -9394,6 +9392,7 @@ static void zend_compile_const(znode *result, zend_ast *ast) /* {{{ */ opline->op2_type = IS_CONST; if (is_fully_qualified || !FC(current_namespace)) { + opline->op1.num = 0; opline->op2.constant = zend_add_const_name_literal( resolved_name, 0); } else { diff --git a/Zend/zend_compile.h b/Zend/zend_compile.h index f1aebddea93..462fc3f7c02 100644 --- a/Zend/zend_compile.h +++ b/Zend/zend_compile.h @@ -27,16 +27,19 @@ #include "zend_llist.h" -#define SET_UNUSED(op) op ## _type = IS_UNUSED +#define SET_UNUSED(op) do { \ + op ## _type = IS_UNUSED; \ + op.num = (uint32_t) -1; \ +} while (0) #define MAKE_NOP(opline) do { \ (opline)->op1.num = 0; \ (opline)->op2.num = 0; \ (opline)->result.num = 0; \ (opline)->opcode = ZEND_NOP; \ - (opline)->op1_type = IS_UNUSED; \ - (opline)->op2_type = IS_UNUSED; \ - (opline)->result_type = IS_UNUSED; \ + SET_UNUSED((opline)->op1); \ + SET_UNUSED((opline)->op2); \ + SET_UNUSED((opline)->result); \ } while (0) #define RESET_DOC_COMMENT() do { \