diff options
-rw-r--r-- | ext/opcache/Optimizer/block_pass.c | 9 | ||||
-rw-r--r-- | ext/opcache/tests/bug75969.phpt | 24 |
2 files changed, 31 insertions, 2 deletions
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c index 9c0fd96471..97e44fe0b2 100644 --- a/ext/opcache/Optimizer/block_pass.c +++ b/ext/opcache/Optimizer/block_pass.c @@ -871,8 +871,6 @@ optimize_const_unary_op: } opline++; } - - strip_nops(op_array, block); } /* Rebuild plain (optimized) op_array from CFG */ @@ -1927,6 +1925,13 @@ void zend_optimize_cfg(zend_op_array *op_array, zend_optimizer_ctx *ctx) zend_optimize_block(b, op_array, usage, &cfg, Tsource); } + /* Eliminate NOPs */ + for (b = blocks; b < end; b++) { + if (b->flags & ZEND_BB_REACHABLE) { + strip_nops(op_array, b); + } + } + /* Jump optimization for each block */ for (b = blocks; b < end; b++) { if (b->flags & ZEND_BB_REACHABLE) { diff --git a/ext/opcache/tests/bug75969.phpt b/ext/opcache/tests/bug75969.phpt new file mode 100644 index 0000000000..733ab2f9b7 --- /dev/null +++ b/ext/opcache/tests/bug75969.phpt @@ -0,0 +1,24 @@ +--TEST-- +Bug #75969: Assertion failure in live range DCE due to block pass misoptimization +--INI-- +opcache.enable_cli=1 +opcache.optimization_level=-1 +--FILE-- +<?php + +// This is required for the segfault +md5('foo'); + +class Extended_Class {}; +$response = array( + 'a' => 'b' +); +new Extended_Class( array( + 'foo' => $response, + 'foo2' => 'bar2' +) ); + +?> +===DONE=== +--EXPECT-- +===DONE=== |