Skip to content

Fix AOT ++/-- no-op on typed locals (#23840) - #23844

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-23840-aot-incdec
Jul 27, 2026
Merged

Fix AOT ++/-- no-op on typed locals (#23840)#23844
PurHur merged 1 commit into
masterfrom
agent/issue-23840-aot-incdec

Conversation

@PurHur

@PurHur PurHur commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

Verification

./script/docker-exec.sh -- bash -lc '
  php bin/compile.php -o /tmp/dec_test /tmp/dec_test.php  # $n=5; $n--; echo $n;
  /tmp/dec_test   # 4 (was 5)
  script/differential-sweep.sh --aot --dir test/differential/cases  # g08 ok
  vendor/bin/phpunit --filter incdec_post_dec_local
'

Output: $n--4; differential AOT g08_incdec_post_dec.php 1/1 match Zend; incdec_post_dec_local OK.

Closes #23840

Made with Cursor

)

#23781 elided the resource guard via IncDecResourceProvenance::cannotBeResource()
inside guardIncDecResourceOperand(), which made post-decrement a silent no-op for
TYPE_VALUE KIND_VALUE locals that fell through to generic binaryOp lowering.

Route scoped boxed locals through the value-box inc/dec path (isIncDecValueBoxLvalue)
and remove the in-guard cannotBeResource early return so guard CFG matches Zend.
cannotBeResourceForString() remains for int→string echo (#23811).

Verified: php bin/compile.php -o /tmp/t '<?php $n=5; $n--; echo $n;' && /tmp/t  # 4
  script/differential-sweep.sh --aot --dir test/differential/cases (g08)
  vendor/bin/phpunit --filter incdec_post_dec_local
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

REGRESSION: AOT ++/-- no longer applies — $n-- is a no-op, for-loop counters produce wrong results, one case hangs

1 participant