Proper check for successors count

This commit is contained in:
Dmitry Stogov 2017-07-14 10:56:42 +03:00
parent ea8c004a15
commit 54bc7b576c

View File

@ -428,13 +428,13 @@ static int simplify_jumps(zend_ssa *ssa, zend_op_array *op_array) {
switch (opline->opcode) { switch (opline->opcode) {
case ZEND_JMPZ_EX: case ZEND_JMPZ_EX:
case ZEND_JMPNZ_EX: case ZEND_JMPNZ_EX:
if (block->successors[1] < 0 && block->successors[0] != block_num + 1) { if (block->successors_count == 1 && block->successors[0] != block_num + 1) {
opline->opcode = ZEND_BOOL; opline->opcode = ZEND_BOOL;
} }
break; break;
case ZEND_JMP_SET: case ZEND_JMP_SET:
case ZEND_COALESCE: case ZEND_COALESCE:
if (block->successors[1] < 0 && block->successors[0] != block_num + 1) { if (block->successors_count == 1 && block->successors[0] != block_num + 1) {
opline->opcode = ZEND_QM_ASSIGN; opline->opcode = ZEND_QM_ASSIGN;
} }
break; break;