mirror of
https://github.com/php/php-src.git
synced 2024-11-24 02:15:04 +08:00
Merge branch 'PHP-8.2'
* PHP-8.2: JIT: Fixed inaccurate range inference usage for UNDEF/NULL/FALSE
This commit is contained in:
commit
f0122664fe
@ -4829,7 +4829,7 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
|
||||
op2_reg = Z_REG(op2_addr);
|
||||
}
|
||||
|
||||
if (!op2_range || (op2_range->min <= 0 && op2_range->max >= 0)) {
|
||||
if ((op2_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) || !op2_range || (op2_range->min <= 0 && op2_range->max >= 0)) {
|
||||
| cbz Rx(op2_reg), >1
|
||||
|.cold_code
|
||||
|1:
|
||||
|
@ -5286,7 +5286,7 @@ static int zend_jit_long_math_helper(dasm_State **Dst,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!op2_range || (op2_range->min <= 0 && op2_range->max >= 0)) {
|
||||
if ((op2_type & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) || !op2_range || (op2_range->min <= 0 && op2_range->max >= 0)) {
|
||||
if (Z_MODE(op2_addr) == IS_MEM_ZVAL) {
|
||||
| cmp aword [Ra(Z_REG(op2_addr))+Z_OFFSET(op2_addr)], 0
|
||||
} else if (Z_MODE(op2_addr) == IS_REG) {
|
||||
|
23
ext/opcache/tests/jit/mod_007.phpt
Normal file
23
ext/opcache/tests/jit/mod_007.phpt
Normal file
@ -0,0 +1,23 @@
|
||||
--TEST--
|
||||
JIT MOD: 007
|
||||
--INI--
|
||||
opcache.enable=1
|
||||
opcache.enable_cli=1
|
||||
opcache.file_update_protection=0
|
||||
opcache.jit_buffer_size=1M
|
||||
opcache.protect_memory=1
|
||||
--FILE--
|
||||
<?php
|
||||
function test($a) {
|
||||
for(;$a < -2;) {
|
||||
$n % $n = $a + $a;
|
||||
}
|
||||
}
|
||||
test(null);
|
||||
?>
|
||||
--EXPECTF--
|
||||
Fatal error: Uncaught DivisionByZeroError: Modulo by zero in %smod_007.php:4
|
||||
Stack trace:
|
||||
#0 %smod_007.php(7): test(NULL)
|
||||
#1 {main}
|
||||
thrown in %smod_007.php on line 4
|
Loading…
Reference in New Issue
Block a user