Merge branch 'PHP-8.0'

* PHP-8.0:
  Fixed Bug #80959 (infinite loop in building cfg during JIT compilation)
This commit is contained in:
Dmitry Stogov 2021-07-21 14:34:04 +03:00
commit a3a74b07e5
3 changed files with 37 additions and 0 deletions

2
NEWS
View file

@ -4,6 +4,8 @@ PHP NEWS
- Opcache:
. Fixed Bug #81255 (Memory leak in PHPUnit with functional JIT)
. Fixed Bug #80959 (infinite loop in building cfg during JIT compilation)
(Nikita, Dmitry)
22 Jul 2021, PHP 8.1.0beta1

View file

@ -893,6 +893,10 @@ ZEND_API int zend_cfg_identify_loops(const zend_op_array *op_array, zend_cfg *cf
j = blocks[j].loop_header;
}
if (j != i) {
if (blocks[j].idom < 0 && j != 0) {
/* Ignore blocks that are unreachable or only abnormally reachable. */
continue;
}
blocks[j].loop_header = i;
for (k = 0; k < blocks[j].predecessors_count; k++) {
zend_worklist_push(&work, cfg->predecessors[blocks[j].predecessor_offset + k]);

View file

@ -0,0 +1,31 @@
--TEST--
Bug #80959: infinite loop in building cfg during JIT compilation
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=1M
opcache.jit=tracing
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
function test($a, $b) {
echo "Start\n";
$i = $j = 0;
do {
$i++;
try {
continue;
} catch (Exception $e) {
}
do {
$j++;
} while ($j < $b);
} while ($i < $a);
echo "Done $i $j\n";
}
test(5, 6);
?>
--EXPECT--
Start
Done 5 0