Skip to content

Commit 7710047

Browse files
committed
JIT x86: Fixed NaN handling
1 parent c30298b commit 7710047

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

ext/opcache/jit/zend_jit_x86.dasc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8617,8 +8617,9 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
86178617
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
86188618
} else {
86198619
| SET_ZVAL_TYPE_INFO res_addr, IS_FALSE
8620-
| jp &exit_addr
8620+
| jp >1
86218621
| je &exit_addr
8622+
|1:
86228623
| SET_ZVAL_TYPE_INFO res_addr, IS_TRUE
86238624
}
86248625
} else if (false_label != (uint32_t)-1) { // JMPZ_EX
@@ -8657,8 +8658,9 @@ static int zend_jit_bool_jmpznz(dasm_State **Dst, const zend_op *opline, uint32_
86578658
| jne &exit_addr
86588659
|1:
86598660
} else {
8660-
| jp &exit_addr
8661+
| jp >1
86618662
| je &exit_addr
8663+
|1:
86628664
}
86638665
} else {
86648666
ZEND_ASSERT(true_label != (uint32_t)-1 || false_label != (uint32_t)-1);

ext/opcache/tests/jit/nan_001.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
NaN handling: 001
3+
--INI--
4+
opcache.enable=1
5+
opcache.enable_cli=1
6+
opcache.file_update_protection=0
7+
opcache.jit_buffer_size=1M
8+
opcache.protect_memory=1
9+
--FILE--
10+
<?php
11+
$b = NAN;
12+
for ($i = 0; $i < 3; $i++) {
13+
if ($b) { echo "nan is true\n"; }
14+
else { echo "nan is false\n"; }
15+
}
16+
?>
17+
--EXPECT--
18+
nan is true
19+
nan is true
20+
nan is true

0 commit comments

Comments
 (0)