File tree Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Expand file tree Collapse file tree 3 files changed +42
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ PHP NEWS
6
6
. Fixed bug #81238 (Fiber support missing for Solaris Sparc). (trowski)
7
7
. Fixed bug #81237 (Comparison of fake closures doesn't work). (krakjoe)
8
8
9
+ - Opcache:
10
+ . Fixed bug #81225 (Wrong result with pow operator with JIT enabled).
11
+ (Dmitry)
12
+
9
13
- Reflection:
10
14
. Fixed bug #80097 (ReflectionAttribute is not a Reflector). (beberlei)
11
15
Original file line number Diff line number Diff line change @@ -4296,17 +4296,20 @@ static int zend_jit_math_long_long(dasm_State **Dst,
4296
4296
} else if (opcode == ZEND_ADD &&
4297
4297
!may_overflow &&
4298
4298
Z_MODE(op1_addr) == IS_REG &&
4299
- Z_MODE(op2_addr) == IS_CONST_ZVAL) {
4299
+ Z_MODE(op2_addr) == IS_CONST_ZVAL &&
4300
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op2_addr)))) {
4300
4301
| lea Ra(result_reg), [Ra(Z_REG(op1_addr))+Z_LVAL_P(Z_ZV(op2_addr))]
4301
4302
} else if (opcode == ZEND_ADD &&
4302
4303
!may_overflow &&
4303
4304
Z_MODE(op2_addr) == IS_REG &&
4304
- Z_MODE(op1_addr) == IS_CONST_ZVAL) {
4305
+ Z_MODE(op1_addr) == IS_CONST_ZVAL &&
4306
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op1_addr)))) {
4305
4307
| lea Ra(result_reg), [Ra(Z_REG(op2_addr))+Z_LVAL_P(Z_ZV(op1_addr))]
4306
4308
} else if (opcode == ZEND_SUB &&
4307
4309
!may_overflow &&
4308
4310
Z_MODE(op1_addr) == IS_REG &&
4309
- Z_MODE(op2_addr) == IS_CONST_ZVAL) {
4311
+ Z_MODE(op2_addr) == IS_CONST_ZVAL &&
4312
+ IS_SIGNED_32BIT(Z_LVAL_P(Z_ZV(op2_addr)))) {
4310
4313
| lea Ra(result_reg), [Ra(Z_REG(op1_addr))-Z_LVAL_P(Z_ZV(op2_addr))]
4311
4314
} else {
4312
4315
| GET_ZVAL_LVAL result_reg, op1_addr
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #81225: Wrong result with pow operator with JIT enabled
3
+ --EXTENSIONS--
4
+ opcache
5
+ --INI--
6
+ opcache.enable=1
7
+ opcache.enable_cli=1
8
+ opcache.jit_buffer_size=1M
9
+ opcache.jit=tracing
10
+ --FILE--
11
+ <?php
12
+
13
+ function unsignedLong (int $ offset ): int
14
+ {
15
+ $ normalizedOffset = $ offset % (2 ** 32 );
16
+
17
+ if ($ normalizedOffset < 0 ) {
18
+ $ normalizedOffset += 2 ** 32 ;
19
+ }
20
+
21
+ return $ normalizedOffset ;
22
+ }
23
+
24
+ $ offset = -0x100000000 + 2 ;
25
+
26
+ for ($ i = 0 ; $ i < 200 ; ++$ i ) {
27
+ assert (unsignedLong ($ offset ) === 2 );
28
+ }
29
+ ?>
30
+ OK
31
+ --EXPECT--
32
+ OK
You can’t perform that action at this time.
0 commit comments