summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--ext/opcache/Optimizer/block_pass.c9
-rw-r--r--ext/opcache/tests/bug75969.phpt24
3 files changed, 33 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index f070163a72..90a7977003 100644
--- a/NEWS
+++ b/NEWS
@@ -41,6 +41,8 @@ PHP NEWS
. Fixed bug #75893 (file_get_contents $http_response_header variable bugged
with opcache). (Nikita)
. Fixed bug #75938 (Modulus value not stored in variable). (Nikita)
+ . Fixed bug #75969 (Assertion failure in live range DCE due to block pass
+ misoptimization). (Nikita)
- SPL:
. Fixed bug #74519 (strange behavior of AppendIterator). (jhdxr)
diff --git a/ext/opcache/Optimizer/block_pass.c b/ext/opcache/Optimizer/block_pass.c
index 6a773c19c1..84d574a72e 100644
--- a/ext/opcache/Optimizer/block_pass.c
+++ b/ext/opcache/Optimizer/block_pass.c
@@ -870,8 +870,6 @@ optimize_const_unary_op:
}
opline++;
}
-
- strip_nops(op_array, block);
}
/* Rebuild plain (optimized) op_array from CFG */
@@ -1934,6 +1932,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===