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: tracing JIT gives wrong sum for $a[0] += $i + 1 on an array parameter in a loop #24437
Expected int(6) (null + 1 + 2 + 3); that is what -d opcache.jit=off prints.
Found at commit c65321c and it still reproduces at 9253b03. Both the checking build and the release build exit 0 and print int(3), with no diagnostic.
Looks like zend_jit_assign_dim_op in ext/opcache/jit/zend_jit_ir.c: in the cold typed-reference branch, op3_addr = real_addr; rebinds OP_DATA (the register holding $i + 1) to its stack slot, but the spill to that slot only runs on the cold path, so the common path reads the addend from a slot that was not written. Using a separate local variable in that branch gives 6 here. PR #18392 touches the same function and may be related; not tested here. #24387 (for #24386) fixes a similar typed-reference problem in zend_jit_assign_op; with it applied this still prints int(3).
Probably the same cause, with %=: with the same command on this file, the checking (ASAN) build stops with AddressSanitizer: FPE in JIT code instead of printing done as the interpreter does (release build not tried). The same local-variable change fixes it.
Activity
ndossche commentedon Oct 19, 2026
Indeed similar to #24387, feel free to open a PR!