Skip to content

Commit 0691e7a

Browse files
committed
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
1 parent 9af0c96 commit 0691e7a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/opcache/Optimizer/block_pass.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,9 +1471,9 @@ static void zend_jmp_optimization(zend_code_block *block, zend_op_array *op_arra
14711471
same_var == VAR_NUM_EX(target->op1) &&
14721472
target_block->follow_to &&
14731473
!target_block->protected) {
1474-
/* JMPZ(X, L), L: X = JMPNZ_EX(X, L2) -> JMPZ(X, L+1) */
1474+
/* JMPZ(X, L), L: T = JMPNZ_EX(X, L2) -> T = JMPZ_EX(X, L+1) */
14751475
last_op->opcode += 3;
1476-
last_op->result = target->result;
1476+
COPY_NODE(last_op->result, target->result);
14771477
del_source(block, block->op2_to);
14781478
block->op2_to = target_block->follow_to;
14791479
ADD_SOURCE(block, block->op2_to);

0 commit comments

Comments
 (0)