Bug #79888 [NEW]: Incorrect execution with JIT enabled

From: Date: Thu, 23 Jul 2020 09:34:40 +0000
Subject: Bug #79888 [NEW]: Incorrect execution with JIT enabled
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228191@lists.php.net to get a copy of this message
From: stefan dot kaeser at diva-e dot com Operating system: Ubuntu 18.04 PHP version: 8.0.0alpha2 Package: Scripting Engine problem Bug Type: Bug Bug description:Incorrect execution with JIT enabled Description: ------------ I have a very basic script for getting the ammount of PrimeNumbers by doing cascaded loops. It's mainly for testing execution times of differen programming languages. When enabling the JIT options, the final result of the script shows an incorrect result. Test was with Alpha3 of Php8, but could not choose that version in Dropdown yet. -------- skaeser@whiplash:~/code/php$ time php7.4 TestPrime.php Testing Primes until: 250000 Primect: 22044 real 0m56,470s user 0m56,456s sys 0m0,009s skaeser@whiplash:~/code/php$ time php8.0 TestPrime.php Testing Primes until: 250000 Primect: 22044 real 0m43,745s user 0m43,733s sys 0m0,008s skaeser@whiplash:~/code/php$ time php8.0 -d opcache.enable_cli=1 -d opcache.jit_buffer_size=50000000 -d opcache.jit=1235 TestPrime.php Testing Primes until: 250000 Primect: 124998 real 0m0,023s user 0m0,014s sys 0m0,009s Test script: --------------- <?php $max = 250000; $cnt = 0; echo "Testing Primes until: " . $max . "\n"; for ($i = 2; $i <= $max; $i++) { if (testPrime($i)) $cnt++; } echo "Primect: {$cnt}\n"; function testPrime(int $a): bool { if ($a < 2) { return false; } else if ($a == 2) { return true; } for ($j = 2; $j < $a; $j++) { if (($a % $j) == 0) { return false; } } return true; } Expected result: ---------------- Testing Primes until: 250000 Primect: 22044 Actual result: -------------- Only with JIT enabled: Testing Primes until: 250000 Primect: 124998 -- Edit bug report at https://bugs.php.net/bug.php?id=79888&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79888&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79888&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79888&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79888&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79888&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79888&r=support Expected behavior: https://bugs.php.net/fix.php?id=79888&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79888&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79888&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79888&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79888&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79888&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79888&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79888&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79888&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79888&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79888&r=mysqlcfg

« previous php.bugs (#228191) next »