Bug #79860 [NEW]: Misoptimization under preloading
| From: | nikic@php.net | Date: | Tue, 14 Jul 2020 15:00:52 +0000 |
| Subject: | Bug #79860 [NEW]: Misoptimization under preloading | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228038@lists.php.net to get a copy of this message | ||
From: nikic
Operating system:
PHP version: 7.4.8
Package: opcache
Bug Type: Bug
Bug description:Misoptimization under preloading
Description:
------------
Test case gets misoptimized under preloading, because the optimization
pipeline runs twice. This happens during the second run of pass 9
(tmpvars):
$_main:
; (lines=27, args=0, vars=6, tmps=5)
; (after pass 5)
; /home/nikic/php/php-src/t049.php:1-10
; return [] RANGE[0..0]
0000 ASSIGN CV0($multi) array(...)
0001 V6 = FE_RESET_R CV0($multi) 0025
0002 T7 = FE_FETCH_R V6 V8 0025
0003 V9 = FETCH_LIST_R V8 int(0)
0004 V10 = FETCH_LIST_R V9 int(0)
0005 ASSIGN CV1($a) V10
0006 V10 = FETCH_LIST_R V9 int(1)
0007 ASSIGN CV2($b) V10
0008 FREE V9
0009 V9 = FETCH_LIST_R V8 int(1)
0010 V10 = FETCH_LIST_R V9 int(0)
0011 ASSIGN CV3($c) V10
0012 V10 = FETCH_LIST_R V9 int(1)
0013 ASSIGN CV4($d) V10
0014 FREE V9
0015 FREE V8
0016 ASSIGN CV5($key) T7
0017 INIT_FCALL 1 96 string("var_dump")
0018 T8 = CONCAT CV5($key) CV1($a)
0019 T7 = CONCAT T8 CV2($b)
0020 T8 = CONCAT T7 CV3($c)
0021 T7 = CONCAT T8 CV4($d)
0022 SEND_VAL T7 1
0023 DO_ICALL
0024 JMP 0002
0025 FE_FREE V6
0026 RETURN int(1)
$_main:
; (lines=27, args=0, vars=6, tmps=4)
; (after pass 9)
; /home/nikic/php/php-src/t049.php:1-10
; return [] RANGE[0..0]
0000 ASSIGN CV0($multi) array(...)
0001 V6 = FE_RESET_R CV0($multi) 0025
0002 T7 = FE_FETCH_R V6 V8 0025
0003 V8 = FETCH_LIST_R V8 int(0)
0004 V9 = FETCH_LIST_R V8 int(0)
0005 ASSIGN CV1($a) V9
0006 V9 = FETCH_LIST_R V8 int(1)
0007 ASSIGN CV2($b) V9
0008 FREE V8
0009 V8 = FETCH_LIST_R V8 int(1)
0010 V9 = FETCH_LIST_R V8 int(0)
0011 ASSIGN CV3($c) V9
0012 V9 = FETCH_LIST_R V8 int(1)
0013 ASSIGN CV4($d) V9
0014 FREE V8
0015 FREE V8
0016 ASSIGN CV5($key) T7
0017 INIT_FCALL 1 96 string("var_dump")
0018 T8 = CONCAT CV5($key) CV1($a)
0019 T7 = CONCAT T8 CV2($b)
0020 T8 = CONCAT T7 CV3($c)
0021 T7 = CONCAT T8 CV4($d)
0022 SEND_VAL T7 1
0023 DO_ICALL
0024 JMP 0002
0025 FE_FREE V6
0026 RETURN int(1)
Test script:
---------------
<?php
$multi = array(
array(array(1,2), array(3,4)),
);
foreach ($multi as list(list($a, $b), list($c, $d))) {
var_dump($a . $b . $c . $d);
}
Expected result:
----------------
string(4) "1234"
Actual result:
--------------
string(2) "12"
--
Edit bug report at https://bugs.php.net/bug.php?id=79860&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79860&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79860&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79860&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79860&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79860&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79860&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79860&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79860&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79860&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79860&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79860&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79860&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79860&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79860&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79860&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79860&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79860&r=mysqlcfg