Bug #75405 [Asn]: Redundant ext infos after optimizing
Edit report at https://bugs.php.net/bug.php?id=75405&edit=1
ID: 75405
Updated by: derick@php.net
Reported by: laruence@php.net
Summary: Redundant ext infos after optimizing
Status: Assigned
Type: Bug
Package: *General Issues
PHP Version: 7.2.0RC4
Assigned To: laruence
Block user comment: N
Private report: N
New Comment:
I would argue that the expected result should be this instead:
Expected result:
----------------
function name: foo
L2-6 foo() /tmp/1.php - 0x7f54cbdde2d0 + 5 ops
L2 #0 EXT_NOP
L2 #1 RECV 1 $s1
L2 #2 RECV 2 $s2
L5 #3 EXT_STMT
L5 #4 RETURN 0
[Script ended normally]
i.e., the EXT_STMT on line 5 instead of three, so that when the debugger stops the state of
variables is correct. If it would stop earlier, only some of the code looks like it has been run,
but the state of the variables looks like after more code (on future lines) have been run.
But then again, $x *never* gets set in the first place, so its value doesn't make it into the
symbol table that Xdebug can access to show its value.
Is there a way to find out whether $x has been optimised out? gdb does this as well, and I think
that would be more useful to have.
Previous Comments:
------------------------------------------------------------------------
[2017-10-19 04:28:01] laruence@php.net
Description:
------------
There are redundant ZEND_EXT_* oplines remained after optimized, this will make profiler/debugger
confused..
Test script:
---------------
<?php
function foo(string $s1, string $s2) {
$x = ($s1 . $s2);
$x = 0;
return $x;
}
?>
runwith sapi/phpdbg/phpdbg -e -p* /tmp/1.php
Expected result:
----------------
function name: foo
L2-6 foo() /tmp/1.php - 0x7f54cbdde2d0 + 5 ops
L2 #0 EXT_NOP
L2 #1 RECV 1 $s1
L2 #2 RECV 2 $s2
L3 #3 EXT_STMT
L5 #4 RETURN 0
[Script ended normally]
Actual result:
--------------
function name: foo
L2-6 foo() /tmp/1.php - 0x7f79e13de2d0 + 7 ops
L2 #0 EXT_NOP
L2 #1 RECV 1 $s1
L2 #2 RECV 2 $s2
L3 #3 EXT_STMT
L4 #4 EXT_STMT
L5 #5 EXT_STMT
L5 #6 RETURN 0
[Script ended normally]
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=75405&edit=1
Thread (8 messages)