You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
I'm facing a strange bug on a "simple" distance calculation (addition in a loop) with PHP cli & opcache JIT enabled.
with opcache.enable_cli = 1 and opcache.jit >= 1252(optimization level between 2 and 5) at some time in the loop the addition (+=) give erratic results.
Only appears when using the phpGPX components.
I've extracted the distance calculation function for standalone & callback tests with same data without any issue.
So, might be related to namespace, object type or whatever...
The bug doesn't affect PHP cgi: tested with the same script, same data same php.ini... configuration without any issue.
I'm running on Windows, self-compiled PHP 8.4.5 TS vs17 x64
I get an assertion failure on 8.4.5 on Windows+JIT (when built in debug mode): Assertion failed: _blocks[use] == b || use_insn->op == IR_PARAM, file ext\opcache\jit\ir\ir_gcm.c, line 948
On PHP-8.4 git HEAD I no longer get the assertion failure but I do get the wrong result on Windows+JIT.
I'll have a look a bit later
<?phpnamespaceFoo;
functiondiff($point1, $point2)
{
$a = deg2rad($point1); // Prefixing these with \ also makes the issue go away$b = deg2rad($point2);
return$a - $b;
}
functiongetRawDistance()
{
$distance = 0;
for ($p = 0; $p < 200; $p++) {
// Needs to be a namespaced call_user_func call to reproduce the issue (i.e. adding \ at front makes the issue go away)$distance += call_user_func('Foo\diff', 0, $p);
}
return$distance;
}
var_dump(getRawDistance());
The above reproducer outputs float(-3.473205211468716) but it should output float(-347.3205211468715). Can only reproduce it on Windows, not on Linux. Run with -d opcache.jit=tracing. Not sure where to start looking and I don't have a capstone package on Windows to look at the disassembly... cc @dstogov
EDIT: it's as if instead of addition to $distance, it assigns to $distance. The result of $distance is always equal to the result of the last call to Foo\diff.
Hi,
I'm facing a strange bug on a "simple" distance calculation (addition in a loop) with PHP cli & opcache JIT enabled.
with
opcache.enable_cli = 1
andopcache.jit >= 1252
(optimization level between 2 and 5) at some time in the loop the addition (+=) give erratic results.I've extracted the distance calculation function for standalone & callback tests with same data without any issue.
So, might be related to namespace, object type or whatever...
Here are "ready to test" files to reproduce it (like on linux)
⏩ Results:
Adding a debug line to DistanceCalculator.php
results, failing @ iteration 128:
Available to perform further tests and provide details if needed
PHP Version
PHP 8.4.5 TS vs17 x64
Operating System
Windows 11 x64
The text was updated successfully, but these errors were encountered: