Skip to content

Commit cd32b47

Browse files
committed
JIT: Fixed register allocation in case of integer overflow
1 parent 2e29817 commit cd32b47

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15733,8 +15733,9 @@ static zend_regset zend_jit_get_scratch_regset(const zend_op *opline, const zend
1573315733
(ssa_op->op1_use != current_var || !last_use)) {
1573415734
ZEND_REGSET_INCL(regset, ZREG_R0);
1573515735
}
15736-
res_info = OP1_INFO();
15736+
res_info = RES_INFO();
1573715737
if (res_info & MAY_BE_DOUBLE) {
15738+
ZEND_REGSET_INCL(regset, ZREG_R0);
1573815739
ZEND_REGSET_INCL(regset, ZREG_XMM0);
1573915740
ZEND_REGSET_INCL(regset, ZREG_XMM1);
1574015741
}

ext/opcache/tests/jit/add_010.phpt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
JIT ADD: 010 overflow handling
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
--SKIPIF--
9+
<?php if (PHP_INT_SIZE != 8) die("skip: 64-bit only"); ?>
10+
--FILE--
11+
<?php
12+
function foo($a) {
13+
var_dump($a+$a=$a+$a=$a+$a=$a);
14+
}
15+
foo(PHP_INT_MAX);
16+
?>
17+
--EXPECT--
18+
float(7.378697629483821E+19)

0 commit comments

Comments
 (0)