Bug #79888 [Asn->Csd]: Incorrect execution with JIT enabled

From: Date: Wed, 29 Jul 2020 14:33:07 +0000
Subject: Bug #79888 [Asn->Csd]: Incorrect execution with JIT enabled
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228276@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79888&edit=1 ID: 79888 Updated by: dmitry@php.net Reported by: stefan dot kaeser at diva-e dot com Summary: Incorrect execution with JIT enabled -Status: Assigned +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: Ubuntu 18.04 PHP Version: 8.0.0alpha3 Assigned To: dmitry Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=02fae1fc537cd256233a5c0f51207a68fe2bd3d8 Log: Fixed bug #79888 (Incorrect execution with JIT enabled) Previous Comments: ------------------------------------------------------------------------ [2020-07-23 10:58:48] nikic@php.net Setting $max = 10000 to reduce runtime, with opcache.jit=1205 I get the incorrect result 5000 and with tracing JIT I get SIGFPE. ------------------------------------------------------------------------ [2020-07-23 09:34:40] stefan dot kaeser at diva-e dot com 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 this bug report at https://bugs.php.net/bug.php?id=79888&edit=1

« previous php.bugs (#228276) next »