Bug #78271 [Ver->Csd]: Invalid result of if-else

From: Date: Wed, 10 Jul 2019 15:29:02 +0000
Subject: Bug #78271 [Ver->Csd]: Invalid result of if-else
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221689@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78271&edit=1

 ID:                 78271
 Updated by:         nikic@php.net
 Reported by:        marekc at softel dot com dot pl
 Summary:            Invalid result of if-else
-Status:             Verified
+Status:             Closed
 Type:               Bug
 Package:            opcache
 Operating System:   Linux Debian 8.11 64bit
 PHP Version:        7.3.7
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e7a83ec8dff962ea624508f18b9b10f5add030cc
Log: Fix bug #78271


Previous Comments:
------------------------------------------------------------------------
[2019-07-10 14:58:36] nikic@php.net

Looks like yet another smart branch fail:

L0 (2):     CV0($a) = RECV 1
L1 (2):     CV1($b) = RECV 2
L2 (3):     T3 = IS_EQUAL CV0($a) int(10)
L3 (9):     JMPZ CV1($b) L6

There should be a NOP after the IS_EQUAL.

------------------------------------------------------------------------
[2019-07-10 14:18:26] marekc at softel dot com dot pl

List of modules below. I can confirm that after disabling opcache the result is "block1"

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

------------------------------------------------------------------------
[2019-07-10 13:55:58] sjon@php.net

Are you sure? Works fine here; https://3v4l.org/3RYph

what additional modules do you have enabled?

------------------------------------------------------------------------
[2019-07-10 13:54:05] nikic@php.net

Confirming under opcache.

------------------------------------------------------------------------
[2019-07-10 13:51:27] marekc at softel dot com dot pl

Description:
------------
The test script should print "block1" but on 7.3.7 prints "none1". Also tested
on 7.2 and 7.1, it's "block1" there.

Test script:
---------------
<?
function test($a, $b){

if($a==10){$w="x";}else{$w="y";}

if($b){$d1="none";$d2="block";}else{$d1="block";$d2="none";}

echo $d2.$b;

}

test(1,1);
?>




Expected result:
----------------
block1

Actual result:
--------------
none1


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=78271&edit=1


Thread (6 messages)

« previous php.bugs (#221689) next »