From: Nikita Popov Date: Sat, 22 Jul 2017 12:53:23 +0000 (+0200) Subject: Fix block removal if there are duplicate successors X-Git-Tag: php-7.2.0beta2~74 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=96665fbfe0d520035f672dc7919b541b288806ca;p=php Fix block removal if there are duplicate successors --- diff --git a/ext/opcache/Optimizer/zend_ssa.c b/ext/opcache/Optimizer/zend_ssa.c index b0c087b1bd..a82d7ff225 100644 --- a/ext/opcache/Optimizer/zend_ssa.c +++ b/ext/opcache/Optimizer/zend_ssa.c @@ -1382,7 +1382,12 @@ void zend_ssa_remove_block(zend_op_array *op_array, zend_ssa *ssa, int i) /* {{{ break; } } - ZEND_ASSERT(pred_offset != -1); + + /* If there are duplicate successors, the predecessors may have been removed in + * a previous iteration already. */ + if (pred_offset == -1) { + continue; + } /* For phis in successor blocks, remove the operands associated with this block */ for (phi = next_ssa_block->phis; phi; phi = phi->next) { diff --git a/ext/opcache/tests/block_removal_with_duplicate_successors.phpt b/ext/opcache/tests/block_removal_with_duplicate_successors.phpt new file mode 100644 index 0000000000..750a169014 --- /dev/null +++ b/ext/opcache/tests/block_removal_with_duplicate_successors.phpt @@ -0,0 +1,15 @@ +--TEST-- +Removing a block that has duplicate successors +--FILE-- + +--EXPECT-- +bar