Hello everyone,
I've encountered a bug in phc on the pre operation handler. It's failing to record
a use that's making its definition getting killed on the DCE pass.
More details as follow. Consider the program below:
<?php
$i = $_ENV['x'];
$i++;
echo $i;
?>
After the first whole program iteration, the "$i = $_ENV['x']" gets kill on DCE, because
the instruction "$i++" is not recording the use for variable $i. This resulted in the
following program:
<?php
$i++;
echo $i;
?>
On the next iteration, the "$i" variable is not defined, hence its constant value can
be propagated as 0. So, 0++ equals to 1. The resultant (erroneous) optimized code is:
<?php
echo 1;
?>
Original issue reported on code.google.com by logytech on 2010-09-21 02:00:06
Original issue reported on code.google.com by
logytech
on 2010-09-21 02:00:06