Skip to content

Commit 0ea8012

Browse files
arnaud-lbdstogov
andauthored
Fix GH-13508: JITed QM_ASSIGN may be optimized out when op1 is null (#13610)
Co-authored-by: Dmitry Stogov <[email protected]>
1 parent 0e05f26 commit 0ea8012

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

ext/opcache/jit/zend_jit_trace.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5070,8 +5070,7 @@ static const void *zend_jit_trace(zend_jit_trace_rec *trace_buffer, uint32_t par
50705070
CHECK_OP1_TRACE_TYPE();
50715071
res_info = RES_INFO();
50725072
res_use_info = zend_jit_trace_type_to_info(
5073-
STACK_MEM_TYPE(stack, EX_VAR_TO_NUM(opline->result.var)))
5074-
& (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE);
5073+
STACK_MEM_TYPE(stack, EX_VAR_TO_NUM(opline->result.var)));
50755074
res_addr = RES_REG_ADDR();
50765075
if (Z_MODE(res_addr) != IS_REG &&
50775076
STACK_TYPE(stack, EX_VAR_TO_NUM(opline->result.var)) !=
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--TEST--
2+
JIT QM_ASSIGN: 004 missing type store
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--FILE--
9+
<?php
10+
11+
function getPropertyScopes($props, $flags): array
12+
{
13+
$propertyScopes = [];
14+
foreach ($props as $prop) {
15+
$tmp = 'x'.$flags;
16+
$propertyScopes[] = $propertyScopes[] = ($flags & 1 ? false : null) . '';
17+
}
18+
19+
return $propertyScopes;
20+
}
21+
22+
var_dump(getPropertyScopes(['a'], 0));
23+
var_dump(getPropertyScopes(['a'], 0));
24+
?>
25+
DONE
26+
--EXPECT--
27+
array(2) {
28+
[0]=>
29+
string(0) ""
30+
[1]=>
31+
string(0) ""
32+
}
33+
array(2) {
34+
[0]=>
35+
string(0) ""
36+
[1]=>
37+
string(0) ""
38+
}
39+
DONE

0 commit comments

Comments
 (0)