Skip to content

Fix incorrect comparison in block optimization pass #10329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Zend/Optimizer/block_pass.c
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,13 @@ static void zend_optimize_block(zend_basic_block *block, zend_op_array *op_array
case ZEND_JMPNZ_EX:
while (1) {
if (opline->op1_type == IS_CONST) {
if (zend_is_true(&ZEND_OP1_LITERAL(opline)) ==
(opline->opcode == ZEND_JMPZ_EX)) {
bool is_jmpz_ex = opline->opcode == ZEND_JMPZ_EX;
if (zend_is_true(&ZEND_OP1_LITERAL(opline)) == is_jmpz_ex) {

++(*opt_count);
opline->opcode = ZEND_QM_ASSIGN;
zval_ptr_dtor_nogc(&ZEND_OP1_LITERAL(opline));
ZVAL_BOOL(&ZEND_OP1_LITERAL(opline), opline->opcode == ZEND_JMPZ_EX);
ZVAL_BOOL(&ZEND_OP1_LITERAL(opline), is_jmpz_ex);
opline->op2.num = 0;
block->successors_count = 1;
block->successors[0] = block->successors[1];
Expand Down