summaryrefslogtreecommitdiff
path: root/ext/opcache/tests/jit
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2020-07-29 17:32:57 +0300
committerDmitry Stogov <dmitry@zend.com>2020-07-29 17:32:57 +0300
commit02fae1fc537cd256233a5c0f51207a68fe2bd3d8 (patch)
treeda90bdc0a9c984c44095c44f0a5b6fd4e61f0276 /ext/opcache/tests/jit
parentee7eecf321fb480485fce7efce0d6deb8629870e (diff)
downloadphp-git-02fae1fc537cd256233a5c0f51207a68fe2bd3d8.tar.gz
Fixed bug #79888 (Incorrect execution with JIT enabled)
Diffstat (limited to 'ext/opcache/tests/jit')
-rw-r--r--ext/opcache/tests/jit/bug79888.phpt38
1 files changed, 38 insertions, 0 deletions
diff --git a/ext/opcache/tests/jit/bug79888.phpt b/ext/opcache/tests/jit/bug79888.phpt
new file mode 100644
index 0000000000..02d4b62ea9
--- /dev/null
+++ b/ext/opcache/tests/jit/bug79888.phpt
@@ -0,0 +1,38 @@
+--TEST--
+Bug #79888 (Incorrect execution with JIT enabled)
+--INI--
+opcache.enable=1
+opcache.enable_cli=1
+opcache.file_update_protection=0
+opcache.jit_buffer_size=64
+opcache.jit=1205
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+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;
+}
+
+$max = 1000;
+$cnt = 0;
+echo "Testing Primes until: " . $max . "\n";
+for ($i = 2; $i <= $max; $i++)
+{
+ if (testPrime($i)) $cnt++;
+}
+echo "Primect: {$cnt}\n";
+?>
+--EXPECT--
+Testing Primes until: 1000
+Primect: 168