Severity
On master 1608e74f9, ++ and -- do not take effect in AOT binaries. This affects the most
basic loop in PHP and produces silent wrong output. One case spins forever.
VM is unaffected. This is a regression: build/micro/m_loop.php
(for ($i = 0; $i < 1000000; ++$i) { ++$a; }) printed 1000000 correctly earlier today.
Reproducers
All built with php bin/compile.php -o <bin> <file> in php-compiler:22.04-dev, LLVM 9. No
resources open in most of them — this is not resource-related.
| program |
Zend |
AOT |
$n = 0; $n--; echo $n; |
-1 |
0 |
$n = 5; $n--; echo $n; |
4 |
5 |
$n = 0; --$n; echo $n; |
-1 |
0 |
$n = 0; $n--; $n--; echo $n; |
-2 |
0 |
$n = 1; $n--; $n--; echo $n; |
-1 |
1 |
$acc=0; for ($i=0;$i<5;++$i) { ++$acc; } echo $acc; |
5 |
0 |
The decrement is a complete no-op — the variable keeps its initial value. The loop case
produces 0, so either the body never executes or ++$acc does not apply.
One case hangs
test/differential/cases/g07_incdec_resource_provenance.php compiled and then spun at 99% CPU
for 27 minutes before I killed it. It terminated normally in runs earlier today, producing wrong
but finite output. Anything running the AOT sweep should be aware that a case can now hang rather
than fail — my sweep script had timeout on the compile but not on the run, which is how this went
unnoticed for half an hour.
Attribution
Bisect in progress; I am not attributing this to any commit yet. Candidate range is
544d1dca9..1608e74f9, which includes:
I will post the bisect result and, if it is mine, revert it immediately.
Suggested guard once fixed
There is currently no differential case covering plain --. g07 covers ++/-- but is
marked @differential-skip-aot pending #23811, so it does not gate the AOT path. A trivial
$n = 5; $n--; case would have caught this.
Severity
On master
1608e74f9,++and--do not take effect in AOT binaries. This affects the mostbasic loop in PHP and produces silent wrong output. One case spins forever.
VM is unaffected. This is a regression:
build/micro/m_loop.php(
for ($i = 0; $i < 1000000; ++$i) { ++$a; }) printed1000000correctly earlier today.Reproducers
All built with
php bin/compile.php -o <bin> <file>inphp-compiler:22.04-dev, LLVM 9. Noresources open in most of them — this is not resource-related.
$n = 0; $n--; echo $n;-10$n = 5; $n--; echo $n;45$n = 0; --$n; echo $n;-10$n = 0; $n--; $n--; echo $n;-20$n = 1; $n--; $n--; echo $n;-11$acc=0; for ($i=0;$i<5;++$i) { ++$acc; } echo $acc;50The decrement is a complete no-op — the variable keeps its initial value. The loop case
produces
0, so either the body never executes or++$accdoes not apply.One case hangs
test/differential/cases/g07_incdec_resource_provenance.phpcompiled and then spun at 99% CPUfor 27 minutes before I killed it. It terminated normally in runs earlier today, producing wrong
but finite output. Anything running the AOT sweep should be aware that a case can now hang rather
than fail — my sweep script had
timeouton the compile but not on the run, which is how this wentunnoticed for half an hour.
Attribution
Bisect in progress; I am not attributing this to any commit yet. Candidate range is
544d1dca9..1608e74f9, which includes:371ada701— Perf: skip the ++/-- resource guard when the value cannot be a resource (#23483) #23781, my own change (skips the ++/-- resource guard when the value provablycannot be a resource). It is a prime suspect precisely because it touches this path, and I am
testing it first with
lib/reverted.5ec8a4453— AOT: TypeError on ++/-- of live fopen resources (#23777) #23794 (AOT: ++/-- on a live resource silently succeeds instead of raising TypeError (#6396 guard never fires at top-level scope) #23777), TypeError on ++/-- of live resources; also touches ++/--.a16c8f1d8— AOT: fix concat ephemeral temp lifetime for dead echo/call operands (#23798) #23827 (AOT: string concat result is freed too early — empty when passed to a function, free(): invalid pointer on reuse #23798), concat ephemeral temp lifetime / entry alloca for dead operands.I will post the bisect result and, if it is mine, revert it immediately.
Suggested guard once fixed
There is currently no differential case covering plain
--.g07covers++/--but ismarked
@differential-skip-aotpending #23811, so it does not gate the AOT path. A trivial$n = 5; $n--;case would have caught this.