com php-src: Fixed bug #77857 (Wrong result if executed with JIT): NEWS ext/opcache/jit/zend_jit_x86.dasc ext/opcache/tests /jit/bug77857.phpt
| From: | Xinchen Hui | Date: | Mon, 08 Apr 2019 16:07:23 +0000 |
| Subject: | com php-src: Fixed bug #77857 (Wrong result if executed with JIT): NEWS ext/opcache/jit/zend_jit_x86.dasc ext/opcache/tests /jit/bug77857.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-105580@lists.php.net to get a copy of this message | ||
Commit: c9fefb31fd06ed2b07345d1c1e9d00dd492399f2
Author: Xinchen Hui <laruence@gmail.com> Tue, 9 Apr 2019 00:07:23 +0800
Parents: 5db671dcd01cd0b68b49964dfcb2b8a2e1ab0454
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c9fefb31fd06ed2b07345d1c1e9d00dd492399f2
Log:
Fixed bug #77857 (Wrong result if executed with JIT)
Bugs:
https://bugs.php.net/77857
Changed paths:
M NEWS
M ext/opcache/jit/zend_jit_x86.dasc
A ext/opcache/tests/jit/bug77857.phpt
Diff:
diff --git a/NEWS b/NEWS
index ac6a98f..914b36a 100644
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,9 @@ PHP NEWS
- Intl:
. Removed deprecated INTL_IDNA_VARIANT_2003. (cmb)
+- JIT:
+ . Fixed bug #77857 (Wrong result if executed with JIT). (Laruence)
+
- LDAP:
. Removed deprecated ldap_sort. (mcmic)
@@ -31,7 +34,4 @@ PHP NEWS
- sodium:
. Fixed bug #77646 (sign_detached() strings not terminated). (Frank)
-- XML:
- . Fixed bug #76874 (xml_parser_free() should never leak memory). (Nikita)
-
<<< NOTE: Insert NEWS from last stable release here prior to actual release! >>>
diff --git a/ext/opcache/jit/zend_jit_x86.dasc b/ext/opcache/jit/zend_jit_x86.dasc
index 56486b9..3dd6f41 100644
--- a/ext/opcache/jit/zend_jit_x86.dasc
+++ b/ext/opcache/jit/zend_jit_x86.dasc
@@ -1131,9 +1131,9 @@ static void* dasm_labels[zend_lb_MAX];
|| }
|| if ((src_info & (MAY_BE_NULL|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_LONG|MAY_BE_DOUBLE)) &&
|| has_concrete_type(src_info & MAY_BE_ANY)) {
-|| zend_uchar type = concrete_type(src_info);
|| if (Z_MODE(dst_addr) == IS_MEM_ZVAL) {
-|| if (((dst_info & MAY_BE_ANY) != (1<<type)) || (dst_info &
(MAY_BE_STRING|MAY_BE_ARRAY)) != 0) {
+|| if (dst_info != src_info) {
+|| zend_uchar type = concrete_type(src_info);
| SET_ZVAL_TYPE_INFO dst_addr, type
|| }
|| }
@@ -10001,7 +10001,7 @@ static zend_bool zend_jit_opline_supports_reg(zend_op_array *op_array,
zend_ssa
op1_info = OP1_INFO();
op2_info = OP2_INFO();
return
- !(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE))) ||
+ !(op1_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)))
&&
!(op2_info & ((MAY_BE_ANY|MAY_BE_REF|MAY_BE_UNDEF)-(MAY_BE_LONG|MAY_BE_DOUBLE)));
case ZEND_BW_OR:
case ZEND_BW_AND:
diff --git a/ext/opcache/tests/jit/bug77857.phpt b/ext/opcache/tests/jit/bug77857.phpt
new file mode 100644
index 0000000..028ea04
--- /dev/null
+++ b/ext/opcache/tests/jit/bug77857.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #77857 (Wrong result if executed with JIT)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=64
+opcache.jit=1205
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function test() {
+ $arr = array_fill(0, 1, 1.0);
+ $y = 0..0;
+ foreach ($arr as $v) {
+ $tmp = 1.0 * $v;
+ var_dump($tmp);
+ $y = $tmp/1.0;
+ }
+ return $y;
+}
+var_dump(test());
+?>
+--EXPECTF--
+float(1)
+float(1)