Bug #77857 [Opn]: Wrong result if executed with JIT
Edit report at https://bugs.php.net/bug.php?id=77857&edit=1
ID: 77857
Updated by: nikic@php.net
Reported by: uchiyama@php.net
Summary: Wrong result if executed with JIT
Status: Open
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:
I can't reproduce this.
Previous Comments:
------------------------------------------------------------------------
[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
Thread (3 messages)