xref: /PHP-8.0/ext/opcache/tests/jit/bug79888.phpt (revision 02fae1fc)
1--TEST--
2Bug #79888 (Incorrect execution with JIT enabled)
3--INI--
4opcache.enable=1
5opcache.enable_cli=1
6opcache.file_update_protection=0
7opcache.jit_buffer_size=64
8opcache.jit=1205
9--SKIPIF--
10<?php require_once('skipif.inc'); ?>
11--FILE--
12<?php
13function testPrime(int $a): bool {
14    if ($a < 2)  {
15        return false;
16    } else if ($a == 2) {
17        return true;
18    }
19    for ($j = 2; $j < $a; $j++) {
20        if (($a % $j) == 0) {
21            return false;
22        }
23    }
24    return true;
25}
26
27$max = 1000;
28$cnt = 0;
29echo "Testing Primes until: " . $max . "\n";
30for ($i = 2; $i <= $max; $i++)
31{
32        if (testPrime($i)) $cnt++;
33}
34echo "Primect: {$cnt}\n";
35?>
36--EXPECT--
37Testing Primes until: 1000
38Primect: 168
39