Bug #77857 [NEW]: Wrong result if executed with JIT
| From: | uchiyama@php.net | Date: | Sat, 06 Apr 2019 04:31:06 +0000 |
| Subject: | Bug #77857 [NEW]: Wrong result if executed with JIT | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-220338@lists.php.net to get a copy of this message | ||
From: uchiyama
Operating system: CentOS 7
PHP version: master-Git-2019-04-06 (Git)
Package: opcache
Bug Type: Bug
Bug description:Wrong result if executed with JIT
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 bug report at https://bugs.php.net/bug.php?id=77857&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77857&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77857&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77857&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=77857&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=77857&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=77857&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=77857&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=77857&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=77857&r=support
Expected behavior: https://bugs.php.net/fix.php?id=77857&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=77857&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=77857&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=77857&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77857&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=77857&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=77857&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=77857&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=77857&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=77857&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=77857&r=mysqlcfg