diff --git a/ext/opcache/jit/zend_jit_ir.c b/ext/opcache/jit/zend_jit_ir.c index e94a86000a0a..8802f3946f51 100644 --- a/ext/opcache/jit/zend_jit_ir.c +++ b/ext/opcache/jit/zend_jit_ir.c @@ -3754,6 +3754,10 @@ static void _zend_jit_fix_merges(zend_jit_ctx *jit) if (k != n) { ir_ref n2, k2; + while (r != q) { + *r = IR_UNUSED; + r++; + } if (k <= 1) { insn->op = IR_BEGIN; insn->inputs_count = 0; diff --git a/ext/opcache/tests/jit/gh24397.phpt b/ext/opcache/tests/jit/gh24397.phpt new file mode 100644 index 000000000000..1ef87a66f3da --- /dev/null +++ b/ext/opcache/tests/jit/gh24397.phpt @@ -0,0 +1,23 @@ +--TEST-- +GH-24397 (JIT: stale label operand on a MERGE reduced to BEGIN) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit_buffer_size=64M +opcache.jit=function +opcache.jit_debug=0x1000000 +--EXTENSIONS-- +opcache +--FILE-- + +--EXPECTF-- +%ADone