Bug #80742 [Ver->Csd]: Opcache JIT makes some boolean logic unexpectedly be true

From: Date: Tue, 16 Feb 2021 17:02:58 +0000
Subject: Bug #80742 [Ver->Csd]: Opcache JIT makes some boolean logic unexpectedly be true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232208@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80742&edit=1 ID: 80742 Updated by: dmitry@php.net Reported by: dktapps at pmmp dot io Summary: Opcache JIT makes some boolean logic unexpectedly be true -Status: Verified +Status: Closed Type: Bug Package: JIT Operating System: Windows 10 PHP Version: 8.0Git-2021-02-13 (Git) 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=fad87a24daa8a79f7bcb9d4088f7d96d6f405cac Log: Fixed bug #80742 (Opcache JIT makes some boolean logic unexpectedly be true) 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

« previous php.bugs (#232208) next »