1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Tracing JIT: Fixed incorrect tracing type inference

There are some cases when IS_VAR/IS_TMP_VAR variables are set to IS_UNDEF.
TODO: It would be better to switch to IS_NULL in master.
This commit is contained in:
Dmitry Stogov
2021-11-10 11:10:44 +03:00
parent a551b08307
commit 203c1b807e
2 changed files with 43 additions and 0 deletions

View File

@@ -1436,6 +1436,12 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
if (op_type != IS_UNKNOWN) {
ssa_var_info[i].type &= zend_jit_trace_type_to_info(op_type);
if (!ssa_var_info[i].type
&& op_type == IS_UNDEF
&& i >= op_array->last_var) {
// TODO: It's better to use NULL instead of UNDEF for temporary variables
ssa_var_info[i].type |= MAY_BE_UNDEF;
}
}
}
i++;

View File

@@ -0,0 +1,37 @@
--TEST--
FE_RESET: 001 undef $$ operand
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.file_update_protection=0
opcache.jit_buffer_size=1M
--FILE--
<?php
for ($i = 0; $i < 5; $i++) {
for ($j = 0; $j < $i; $j++) {}
foreach ($$i as $x) {}
}
?>
OK
--EXPECTF--
Warning: Undefined variable $0 in %sfe_reset_001.php on line 4
Warning: foreach() argument must be of type array|object, null given in %sfe_reset_001.php on line 4
Warning: Undefined variable $1 in %sfe_reset_001.php on line 4
Warning: foreach() argument must be of type array|object, null given in %sfe_reset_001.php on line 4
Warning: Undefined variable $2 in %sfe_reset_001.php on line 4
Warning: foreach() argument must be of type array|object, null given in %sfe_reset_001.php on line 4
Warning: Undefined variable $3 in %sfe_reset_001.php on line 4
Warning: foreach() argument must be of type array|object, null given in %sfe_reset_001.php on line 4
Warning: Undefined variable $4 in %sfe_reset_001.php on line 4
Warning: foreach() argument must be of type array|object, null given in %sfe_reset_001.php on line 4
OK