Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ext/opcache/jit/zend_jit_ir.c
Original file line number Diff line number Diff line change
Expand Up @@ -1398,7 +1398,9 @@ static void zend_jit_def_reg(zend_jit_ctx *jit, zend_jit_addr addr, ir_ref val)
if (dst_phi->pi >= 0) {
jit->ra[src_var].ref = val;
src_var = dst_phi->ssa_var;
if (!(jit->ra[src_var].flags & ZREG_FORWARD)) {
if (!(jit->ra[src_var].flags & ZREG_FORWARD)
/* Pi in a block that is not generated yet. It forwards later on its own. */
|| (jit->bb_start_ref && !jit->bb_start_ref[dst_phi->block])) {
phi = zend_ssa_next_use_phi(jit->ssa, var, phi);
continue;
}
Expand Down
22 changes: 22 additions & 0 deletions ext/opcache/tests/jit/gh24396.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
GH-24396: Assertion failure in zend_jit_def_reg() "reg forwarding" with chained Pi nodes
--EXTENSIONS--
opcache
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit=function
--FILE--
<?php
function f() {
$i = 0;
do {
$i = ($i + 1) & 255;
} while ($i < 2 || $i > 200);
return $i;
}
var_dump(f());
?>
--EXPECT--
int(2)
Loading