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: switch on constant null takes default instead of case 0 (opcache.jit=function, optimization_level=0) #24391
Expected int(1), since null == 0 is true. The interpreter with the same settings but opcache.jit=0 prints int(1).
Found at c65321c and it still reproduces at 5ccc56b. The debug/sanitizer build and the release build both print int(6) with exit code 0, no assertion or crash. With the default opcache.optimization_level the output is int(1), and with 3 cases instead of 5 it is also right (no jump table is emitted).
This looks like the IS_CONST branch of zend_jit_switch in ext/opcache/jit/zend_jit_ir.c: for a constant of the wrong type for SWITCH_LONG/SWITCH_STRING it goes to the default target, while the VM handler continues at opline+1 (the IS_EQUAL chain).
The tracing JIT trips over the same branch. Here switch (0) compiles to SWITCH_STRING with an int constant, the VM continues at opline+1, and the JIT's default target does not match the trace:
Activity