Skip to content

Treat direct *out = p writes as out-parameter returns in facade retention proofs (closes #3175) - #3645

Merged
ehartford merged 1 commit into
mainfrom
out-param-return-proof
Nov 27, 2026
Merged

ehartford merged 1 commit into
mainfrom
out-param-return-proof

Conversation

@ehartford

Copy link
Copy Markdown
Contributor

Implements Eric's ruling on #3175 (2026-11-25):

  • A parameter (or a pointer derived from it) written directly through another parameter's slot (*out = p, not out->field = p) is recorded as an out-parameter return (outstore:<slot>:<src>) rather than an unconditional paramstore: store (src/CImport.with).
  • Direct calls emit outcall:<callee>:<argmap> tagging &l<loc>, &p<pi>, p<pi>, l<loc>.
  • CiFacadeDraft.with computes the joint fixed point over retention, out-parameter returns (param_out_returns), and caller aliases:
    • Caller passing &local or &param in its own frame creates an alias (retained only if the alias later escapes).
    • Caller passing its own out-parameter propagates a transitive out-return.
    • Caller passing &global, &h->field, or anything else marks the parameter retained.
    • Field stores (out->field = p) remain stores.
    • Public functions that return a parameter through *out = p stay raw.
    • localaddr: exempts slots proven to be pure direct out-return slots (fd_out_slot_safe_for_addr).
  • Adds test/internals/conan_facade_out_param_return_test.with covering all 9 cases (including &param matching libcurl's dollarstring(fmt, &fmt), &local, transitive wrapper, pointer-arithmetic derived local into &global, &global, &h->saved, escaping local alias, out->saved = p, and public out-returning function staying raw).

Closes #3175.

@ehartford
ehartford force-pushed the out-param-return-proof branch from 1a462a4 to fb0a174 Compare November 27, 2026 04:54
@ehartford

Copy link
Copy Markdown
Contributor Author

Battery and :release-checks green on fb0a17471 (darwin-aarch64):

  • with run tools/verdict.with out/battery/battery.log: rc=0 green (wall=754s)
  • UATs: 12/12 macOS scenarios pass (raylib_spiral_windows skipped on darwin-aarch64)
  • WITH=$PWD/src/main src/main build :release-checks: all targets green (wall=588.2s, stage2 == stage3 over all 16 units of the compiler, EMIT-C OK, EMIT-C FIXPOINT, rt-bundle-fixpoint)

@ehartford
ehartford marked this pull request as ready for review November 27, 2026 05:17
@ehartford
ehartford merged commit 492ff9d into main Nov 27, 2026
1 check passed
@ehartford
ehartford deleted the out-param-return-proof branch November 27, 2026 05:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant