diff --git a/ext/opcache/jit/zend_jit_trace.c b/ext/opcache/jit/zend_jit_trace.c index 9c54767fc226..2b9852aa6142 100644 --- a/ext/opcache/jit/zend_jit_trace.c +++ b/ext/opcache/jit/zend_jit_trace.c @@ -4493,7 +4493,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD; } else if (opline->result_type != IS_UNUSED && (res_info & (MAY_BE_ANY|MAY_BE_GUARD)) == (MAY_BE_DOUBLE|MAY_BE_GUARD) - && !(res_info & MAY_BE_STRING)) { + && !(op1_info & MAY_BE_STRING)) { ssa->var_info[ssa_op->result_def].type &= ~MAY_BE_GUARD; } goto done; diff --git a/ext/opcache/tests/jit/inc_025.phpt b/ext/opcache/tests/jit/inc_025.phpt new file mode 100644 index 000000000000..c6dceb7ea8e9 --- /dev/null +++ b/ext/opcache/tests/jit/inc_025.phpt @@ -0,0 +1,43 @@ +--TEST-- +JIT INC: 025 (result type of ++/-- on a reference after the trace saw a float) +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.file_update_protection=0 +opcache.protect_memory=1 +opcache.jit=tracing +--EXTENSIONS-- +opcache +--FILE-- +t = $a; $x = &$o->t; $out = []; + for ($i = 0; $i < 4; $i++) { $out[] = $x++; } + return $out; +} + +foreach (['pre_inc', 'post_inc', 'pre_dec', 'glob_inc', 'stat_inc'] as $f) { + for ($n = 0; $n < 20; $n++) { + $f(1.5); + } + echo $f, ' ', json_encode($f(5)), "\n"; +} +for ($n = 0; $n < 20; $n++) { + typed_ref_inc(1.5); +} +echo 'typed_ref_inc ', json_encode(typed_ref_inc("2.5")), "\n"; +?> +--EXPECT-- +pre_inc [6,7,8,9] +post_inc [5,6,7,8] +pre_dec [4,3,2,1] +glob_inc [6,7,8,9] +stat_inc [6,7,8,9] +typed_ref_inc ["2.5",3.5,4.5,5.5]