Skip to content

Commit 1674c96

Browse files
committed
Bug #80447 (Strange out of memory error when running with JIT)
1 parent 8ad2b59 commit 1674c96

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

NEWS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ PHP NEWS
2525
. Fixed bug #80377 (Opcache misses executor_globals). (Nikita)
2626
. Fixed bug #80433 (Unable to disable the use of the AVX command when using
2727
JIT). (Nikita)
28+
. Bug #80447 (Strange out of memory error when running with JIT). (Dmitry)
2829

2930
- OpenSSL:
3031
. Fixed bug #80368 (OpenSSL extension fails to build against LibreSSL due to

ext/opcache/jit/zend_jit_trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3662,7 +3662,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
36623662

36633663
zend_jit_label(&dasm_state, 0); /* start of of trace loop */
36643664

3665-
if (ra && trace_buffer->stop == ZEND_JIT_TRACE_STOP_LOOP) {
3665+
if (ra) {
36663666
zend_ssa_phi *phi = ssa->blocks[1].phis;
36673667

36683668
while (phi) {

ext/opcache/tests/jit/bug80447.phpt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
--TEST--
2+
Bug #80447 (Strange out of memory error when running with JIT)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--SKIPIF--
10+
<?php require_once('skipif.inc'); ?>
11+
--FILE--
12+
<?php
13+
function createTree($depth) {
14+
if (!$depth) {
15+
return [null, null];
16+
}
17+
$depth--;
18+
19+
return [
20+
createTree($depth),
21+
createTree($depth)
22+
];
23+
}
24+
25+
function checkTree($treeNode) {
26+
return 1
27+
+ ($treeNode[0][0] === null ? 1 : checkTree($treeNode[0]))
28+
+ ($treeNode[1][0] === null ? 1 : checkTree($treeNode[1]));
29+
}
30+
31+
$tree = createTree(12);
32+
var_dump(checkTree($tree));
33+
--EXPECT--
34+
int(8191)

0 commit comments

Comments
 (0)