Merge branch 'PHP-8.0' into PHP-8.1

* PHP-8.0:
  Tracing JIT: Fixed incorrect tracing type inference
This commit is contained in:
Dmitry Stogov 2021-11-10 11:13:48 +03:00
commit 936c6df022
2 changed files with 43 additions and 0 deletions

View file

@ -1540,6 +1540,12 @@ static zend_ssa *zend_jit_trace_build_tssa(zend_jit_trace_rec *trace_buffer, uin
if (op_type != IS_UNKNOWN) { if (op_type != IS_UNKNOWN) {
ssa_var_info[i].type &= zend_jit_trace_type_to_info(op_type); 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++; 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