Bug #80742 [Opn->Ver]: Opcache JIT makes some boolean logic unexpectedly be true
Edit report at https://bugs.php.net/bug.php?id=80742&edit=1
ID: 80742
Updated by: nikic@php.net
Reported by: dktapps at pmmp dot io
Summary: Opcache JIT makes some boolean logic unexpectedly be
true
-Status: Open
+Status: Verified
Type: Bug
Package: JIT
Operating System: Windows 10
PHP Version: 8.0Git-2021-02-13 (Git)
-Assigned To:
+Assigned To: dmitry
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2021-02-13 00:47:35] dktapps at pmmp dot io
Description:
------------
JIT breaks some boolean logic involving and in ways I don't understand.
It's possible this occurs with other operators, but I stumbled on this in code in the wild so I
haven't tested further.
When running the following using -dopcache.jit=0 (or without opcache), the script produces the
expected result.
Using -dopcache.jit=1205 produces the broken result.
This occurs in a minimal NTS build with only PHP and OPcache using https://github.com/php/php-src/commit/6ec25f386ff058b5ecda6f11c5f62e934b31f660,
so it's easily reproducible.
Test script:
---------------
<?php
function checkGroundState(float $movY, float $dy) : void{
var_dump($movY != $dy, $movY < 0, ($movY != $dy and $movY < 0));
var_dump("wow!");
}
checkGroundState(0, 0);
Expected result:
----------------
bool(false)
bool(false)
bool(false)
string(4) "wow!"
Actual result:
--------------
bool(false)
bool(false)
bool(true)
string(4) "wow!"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80742&edit=1
Thread (3 messages)