diff --git a/ext/opcache/tests/jit/gh25247.phpt b/ext/opcache/tests/jit/gh25247.phpt new file mode 100644 index 000000000000..0eb7ebbfe785 --- /dev/null +++ b/ext/opcache/tests/jit/gh25247.phpt @@ -0,0 +1,55 @@ +--TEST-- +GH-25247 (Tracing JIT: argument 13+ keeps a stale value when the operand is a QM_ASSIGN left in a register) +--EXTENSIONS-- +opcache +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.jit=tracing +opcache.jit_buffer_size=64M +opcache.jit_hot_loop=1 +opcache.jit_hot_func=1 +opcache.jit_hot_return=1 +opcache.jit_hot_side_exit=1 +--FILE-- +x = 'x'; +$o->y = 1; +$c = true; +$x = null; +$a = 1; +$b = 2; + +for ($i = 0; $i < 5; $i++) { + $checks = [ + [$f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, $o->x, $o->y === 1 ? 1 : 2), 1], + [$f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, $c ? helper_int() : 0), 1], + [$f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, $c ? max($a, $b) : 0), 2], + [$f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, $x ?? helper_int()), 1], + [$f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, $o->y === 1 ? 1.5 : 2.5), 1.5], + [$f(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, $c ? helper_str() : 'no'), 's'], + [$f12(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, $o->y === 1 ? 1 : 2, 13), 1], + ]; + foreach ($checks as $n => [$got, $expect]) { + if ($got !== $expect) { + echo "iteration $i check $n: ", var_export($got, true), ", expected ", var_export($expect, true), "\n"; + exit(1); + } + } +} +echo "OK\n"; +?> +--EXPECT-- +OK