Bug #80745 [Com]: JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts

From: Date: Sat, 13 Feb 2021 17:39:17 +0000
Subject: Bug #80745 [Com]: JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232135@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80745&edit=1 ID: 80745 Comment by: JaxkDev at gmail dot com Reported by: dktapps at pmmp dot io Summary: JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts Status: Open Type: Bug Package: JIT Operating System: Linux PHP Version: 8.0.2 Block user comment: N Private report: N New Comment: Reproduced on windows 10 (10.0.19042.804), PHP 8.0.2 ZTS (opcache.jit=1205) Previous Comments: ------------------------------------------------------------------------ [2021-02-13 16:16:09] dktapps at pmmp dot io Description: ------------ The following code crashes with PHP 8.0.2 ZTS DEBUG when opcache is enabled using opcache.jit=1205. This happens on both Windows and Linux. Test script: --------------- <?php final class Message { public $qr = false; public $opcode = 0; public $aa = false; } echo "Starting...\n"; function headerToBinary(Message $message) { $flags = 0; $flags = ($flags << 1) | ($message->qr ? 1 : 0); $flags = ($flags << 4) | $message->opcode; var_dump($flags); $flags = ($flags << 1) | ($message->aa ? 1 : 0); } headerToBinary(new Message()); echo "PROBLEM NOT REPRODUCED !\n"; Expected result: ---------------- Starting... int(0) PROBLEM NOT REPRODUCED ! Actual result: -------------- In release mode --------------- Starting... UNKNOWN:0 PHP Fatal error: Uncaught TypeError: Unsupported operand types: null << int in /home/runner/work/php-8-jit-bug-1/php-8-jit-bug-1/reproduce.php:20 Stack trace: #0 /home/runner/work/php-8-jit-bug-1/php-8-jit-bug-1/reproduce.php(23): headerToBinary() #1 {main} thrown in /home/runner/work/php-8-jit-bug-1/php-8-jit-bug-1/reproduce.php on line 20 In debug mode ------------- Starting... UNKNOWN:0 php: /tmp/php-build/source/8.0.2/Zend/zend_operators.c:345: zendi_try_get_long: Assertion `0' failed. Aborted (core dumped) ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=80745&edit=1

« previous php.bugs (#232135) next »