You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: ir_save assertion ((ref) < 0) failed when dumping IR with opcache.jit_debug on a foreach loop #24397
With a debug build, dumping the JIT IR via opcache.jit_debug aborts in ir_save() on a function containing a foreach. The script was generated by a testing tool, not taken from a real program.
I expected the full IR dump to be printed and the process to exit 0, which is what the release build does with the same command.
Reproduces at 17b6575 (latest upstream when checked). The debug build aborts with SIGABRT (exit 134); the release build prints the whole dump and exits 0, so this is an assertion-only failure. Without opcache.jit_debug the debug build runs the script cleanly. Any of the IR dump bits 1<<24 to 1<<31 trigger it; the tracing JIT with the same bit did not fail on this input.
This looks like ir_save() in ext/opcache/jit/ir/ir_save.c (case IR_OPND_LABEL_REF) assuming a non-zero label operand is a constant (negative) ref, while the BEGIN node of the foreach loop has an instruction (positive) ref there. Either the IR builder or the dumper's assumption is off.
I can send a patch if that helps.
Found with an LLM-based testing tool; I used Claude to reduce it and look for the cause.
Activity