summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-12-01 16:43:05 +0300
committerDmitry Stogov <dmitry@zend.com>2020-12-01 16:43:05 +0300
commit1674c96c0b7ab05809a9a3e51a96901a4c424274 (patch)
tree51725396a5e85eb4422ab0f0e31d88438ab80e8e
parent8ad2b59e12887d3f4952291b7d63ec9838a386d8 (diff)
downloadphp-git-1674c96c0b7ab05809a9a3e51a96901a4c424274.tar.gz
Bug #80447 (Strange out of memory error when running with JIT)
-rw-r--r--NEWS1
-rw-r--r--ext/opcache/jit/zend_jit_trace.c2
-rw-r--r--ext/opcache/tests/jit/bug80447.phpt34
3 files changed, 36 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index a60ed29a1c..695ae7408d 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ PHP NEWS
. Fixed bug #80377 (Opcache misses executor_globals). (Nikita)
. Fixed bug #80433 (Unable to disable the use of the AVX command when using
JIT). (Nikita)
+ . Bug #80447 (Strange out of memory error when running with JIT). (Dmitry)
- OpenSSL:
. Fixed bug #80368 (OpenSSL extension fails to build against LibreSSL due to
diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c
index 19db7c54bb..33658f8e86 100644
--- a/ext/opcache/jit/zend_jit_trace.c
+++ b/ext/opcache/jit/zend_jit_trace.c
@@ -3662,7 +3662,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
zend_jit_label(&dasm_state, 0); /* start of of trace loop */
- if (ra && trace_buffer->stop == ZEND_JIT_TRACE_STOP_LOOP) {
+ if (ra) {
zend_ssa_phi *phi = ssa->blocks[1].phis;
while (phi) {
diff --git a/ext/opcache/tests/jit/bug80447.phpt b/ext/opcache/tests/jit/bug80447.phpt
new file mode 100644
index 0000000000..b09ff5c698
--- /dev/null
+++ b/ext/opcache/tests/jit/bug80447.phpt
@@ -0,0 +1,34 @@
+--TEST--
+Bug #80447 (Strange out of memory error when running with JIT)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=1M
+opcache.protect_memory=1
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function createTree($depth) {
+ if (!$depth) {
+ return [null, null];
+ }
+ $depth--;
+
+ return [
+ createTree($depth),
+ createTree($depth)
+ ];
+}
+
+function checkTree($treeNode) {
+ return 1
+ + ($treeNode[0][0] === null ? 1 : checkTree($treeNode[0]))
+ + ($treeNode[1][0] === null ? 1 : checkTree($treeNode[1]));
+}
+
+$tree = createTree(12);
+var_dump(checkTree($tree));
+--EXPECT--
+int(8191)