Bug #77857 [Opn->Csd]: Wrong result if executed with JIT
| From: | laruence@php.net | Date: | Mon, 08 Apr 2019 16:07:50 +0000 |
| Subject: | Bug #77857 [Opn->Csd]: Wrong result if executed with JIT | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-220365@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77857&edit=1
ID: 77857
Updated by: laruence@php.net
Reported by: uchiyama@php.net
Summary: Wrong result if executed with JIT
-Status: Open
+Status: Closed
Type: Bug
Package: opcache
Operating System: CentOS 7
PHP Version: master-Git-2019-04-06 (Git)
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c9fefb31fd06ed2b07345d1c1e9d00dd492399f2
Log: Fixed bug #77857 (Wrong result if executed with JIT)
Previous Comments:
------------------------------------------------------------------------
[2019-04-08 08:49:52] nikic@php.net
I can't reproduce this.
------------------------------------------------------------------------
[2019-04-06 04:31:06] uchiyama@php.net
Description:
------------
The test script ends with a wrong result if JIT is enabled as follows:
$ ./sapi/cli/php -n -derror_reporting=-1 -dzend_extension=
pwd/modules/opcache.so
-dopcache.enable_cli=1 -dopcache.jit_buffer_size=32M Test.php
Note: without JIT (i.e. remove -dopcache.jit_buffer_size=32M), it ends with the expected result.
// System info
$ cat /proc/cpuinfo | grep '^model name'
model name : Intel(R) Core(TM) i5-3337U CPU @ 1.80GHz
$ cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
// Commit id
$ git log --oneline -n1
7b58e43 Merge branch 'PHP-7.4'
Test script:
---------------
<?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());
Expected result:
----------------
float(1)
float(1)
Actual result:
--------------
float(255814795264)
Notice: Undefined variable: tmp in /.../Test.php on line 8
float(0)
// the value in the first line ($tmp) is changed arbitrary by each execution.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77857&edit=1