Bug #80745 [NEW]: JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts
| From: | dktapps at pmmp dot io | Date: | Sat, 13 Feb 2021 16:16:09 +0000 |
| Subject: | Bug #80745 [NEW]: JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-232133@lists.php.net to get a copy of this message | ||
From: dktapps at pmmp dot io
Operating system: Linux
PHP version: 8.0.2
Package: JIT
Bug Type: Bug
Bug description:JIT produces Assert failure and UNKNOWN:0 var_dumps in code involving bitshifts
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 bug report at https://bugs.php.net/bug.php?id=80745&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80745&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80745&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80745&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80745&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80745&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80745&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80745&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80745&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80745&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80745&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80745&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80745&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80745&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80745&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80745&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80745&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80745&r=mysqlcfg