From: Nikita Popov Date: Wed, 4 May 2016 21:52:42 +0000 (+0200) Subject: Fix JMPZ, JMPZNZ_EX chain optimization X-Git-Tag: php-7.0.7RC1~24 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0691e7a8e15ace3ce186ceb8c27753325a5a956f;p=php Fix JMPZ, JMPZNZ_EX chain optimization The result_type was not copied, resulting in a corrupted JMPZ_EX. Fix can be verified by inspecting the opcodes of the following function (it should not contain any _EX opcodes): function test() { if ($a && $b) { echo "a"; } if ($b || $c || $d) { echo "b"; } } Conflicts: ext/opcache/Optimizer/block_pass.c --- diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index e168457661..5e9b20d191 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -1471,9 +1471,9 @@ next_target: same_var == VAR_NUM_EX(target->op1) && target_block->follow_to && !target_block->protected) { - /* JMPZ(X, L), L: X = JMPNZ_EX(X, L2) -> JMPZ(X, L+1) */ + /* JMPZ(X, L), L: T = JMPNZ_EX(X, L2) -> T = JMPZ_EX(X, L+1) */ last_op->opcode += 3; - last_op->result = target->result; + COPY_NODE(last_op->result, target->result); del_source(block, block->op2_to); block->op2_to = target_block->follow_to; ADD_SOURCE(block, block->op2_to);