Skip to content

AOT: fix min()/max() boxed variadic compare (#23779) - #23801

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

AOT: fix min()/max() boxed variadic compare (#23779)#23801
PurHur merged 1 commit into
masterfrom
agent/issue-23779-aot-sweep

Conversation

@PurHur

@PurHur PurHur commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix inverted max() compare/select in JitMinMax::reduceNativeDouble (variadic float path).
  • Rewrite boxed min()/max() lowering to return the winning __value__* operand instead of a compare scalar; add lexicographic strcmp path when both operands are strings.

Root cause: reduceNumericBoxes compared coerced doubles but kept the smaller compare magnitude and used reversed branch logic for max(), so max(g(1), g(3)) returned 2 and max('xy','zw') returned float(0).

Test plan

  • php bin/vm.php test/repro/issue_23779_max_nested_call.php — VM: 6 / zw
  • ./phpc build -o /tmp/r test/repro/issue_23779_max_nested_call.php && /tmp/r — AOT: 6 / zw
  • php bin/vm.php test/differential/cases/e09_nested_calls.php — VM: 6 / 5
  • ./phpc build -o /tmp/e09 test/differential/cases/e09_nested_calls.php && /tmp/e09 — AOT: 6 / 5
  • php bin/vm.php test/repro/issue_4347_max_min_numeric_string.php + AOT build — 3.5 / 2 (unchanged)
  • script/differential-sweep.sh --aot29/55 match Zend (was 28/54 on master before this branch)
  • Full ci-fast.sh not run (scoped AOT builtin change only)

Closes #23779 (partial — one cluster; remaining AOT sweep failures tracked on the umbrella issue).

Made with Cursor

…23779)

JitMinMax inverted the max() double/boxed compare select and returned
compare scalars instead of the winning __value__ operand, breaking cases
like max(g(1), g(3)) and string max() on the AOT path.

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.

AOT differential sweep: 27 of 53 cases fail on master (half the least-covered path is untested-broken)

1 participant