You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A literal passed to a by-reference parameter through an erased callable corrupts the closure's return value instead of throwing "could not be passed by reference" #597
A literal passed to a by-reference parameter through an erased callable corrupts the closure's return value instead of throwing "could not be passed by reference".
ret 'closure'
Error: {closure}(): Argument #1 ($x) could not be passed by reference
Actual (manticore 9ccbe2ba, Darwin arm64)
ret ''losure'
ret ''losure'
Tracking
Known-bug repro: tests/aot/repro/wrong/erased_invoke_literal_to_byref_corrupts.php — bash tests/aot/xfail.sh -k erased_invoke_literal_to_byref_corrupts reports XFAIL while this is open and XPASS once it is fixed; then move the repro into tests/aot/cases/ and close this issue.
Root cause found during the #655 sweep (not fixed, needs design): (1) the outlined erased-invoke helper (__mir_erinv_*) hands a by-value argument word it only BORROWS to a by-ref closure slot; the closure's write drops it, so the caller's temporary is released twice — that is the corruption. (2) php's "Argument #N ($x) could not be passed by reference" needs which arguments are literals (the helper only sees values, modes r/v) and the parameter name (absent from the closure prefix metadata). Fixing (1) alone does not flip the repro.
Activity
Repros: an erased invoke reports trace line 0 (#598), and a literal b…
Cut large-app build time: fewer inference passes, smaller IR, cheaper…
blacktrs commentedon Nov 12, 2026
Root cause found during the #655 sweep (not fixed, needs design): (1) the outlined erased-invoke helper (
__mir_erinv_*) hands a by-value argument word it only BORROWS to a by-ref closure slot; the closure's write drops it, so the caller's temporary is released twice — that is the corruption. (2) php's "Argument #N ($x) could not be passed by reference" needs which arguments are literals (the helper only sees values, modes r/v) and the parameter name (absent from the closure prefix metadata). Fixing (1) alone does not flip the repro.