Skip to content

Commit 035ca2f

Browse files
committed
Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5: ext/opcache: Clear vacated MERGE inputs before conversion to BEGIN
2 parents 334bdea + 1de9cb7 commit 035ca2f

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

‎NEWS‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ PHP NEWS
7474
cannot describe a parameter). (Ilia Alshanetsky)
7575

7676
- Opcache:
77+
. Fixed bug GH-24397 (Assertion failure when dumping JIT IR).
78+
(Ilia Alshanetsky)
7779
. Fixed tracing JIT returning a wrapped integer instead of a float on
7880
integer overflow after an integer was compared with a float or
7981
numeric-string literal. (Ilia Alshanetsky)

‎ext/opcache/jit/zend_jit_ir.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,11 @@ static void _zend_jit_fix_merges(zend_jit_ctx *jit)
36963696
if (k != n) {
36973697
ir_ref n2, k2;
36983698

3699+
/* BEGIN reads op2 as a label, so clear the vacated inputs */
3700+
while (r != q) {
3701+
*r = IR_UNUSED;
3702+
r++;
3703+
}
36993704
if (k <= 1) {
37003705
insn->op = IR_BEGIN;
37013706
insn->inputs_count = 0;

‎ext/opcache/tests/jit/gh24397.phpt‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
--TEST--
2+
GH-24397 (JIT: stale label operand on a MERGE reduced to BEGIN)
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=64M
8+
opcache.jit=function
9+
opcache.jit_debug=0x1000000
10+
--EXTENSIONS--
11+
opcache
12+
--FILE--
13+
<?php
14+
function f() {
15+
foreach ([1, 2] as $v) {
16+
$c[] = $v;
17+
}
18+
}
19+
f();
20+
echo "Done\n";
21+
?>
22+
--EXPECTF--
23+
%ADone

0 commit comments

Comments
 (0)