Skip to content

feat: implement noalias and restrict propagation (#731) - #1388

Merged
godofecht merged 15 commits into
mainfrom
fix-731-13751263526198508203
Oct 6, 2026
Merged

godofecht merged 15 commits into
mainfrom
fix-731-13751263526198508203

Conversation

@godofecht

@godofecht godofecht commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Correctness hardening (2026-10-06, pending native verification): The noalias predicate previously added two signed-i32 offsets/lengths directly; signed overflow is undefined in generated C and can incorrectly certify overlapping spans as disjoint. The new implementation uses nonnegative ordered-offset subtraction, rejects negative/unknown/zero-length same-root views, checks constant subspan end <= known base length, guards pointer offset addition and widens field hashing to i64 modulo. Added tests/lang/test_noalias_overflow.flow with a genuinely overlapping INT32_MAX boundary case. A portable C mirror of this predicate passed 500,000 deterministic intervals and 3 boundary assertions under Clang UBSan. This does not run the Flow compiler; the source and bootstrap C must be regenerated and strict C/MLIR/noalias regressions run locally before merging. #731 remains open.


Closes #731. Supersedes #1368.\n\nThis propagates local region/non-alias proofs into function parameters and temporaries. It defines the soundness boundary for restrict/LLVM noalias-style metadata, preserves provenance through spans/arrays/views, and adds mixed-site cloning so numerical loops no longer need raw-pointer/manual C escape hatches to expose disjointness.


PR created automatically by Jules for task 13751263526198508203 started by @godofecht

… Supersedes #1368.\n\nThis propagates local region/non-alias proofs into function parameters and temporaries. It defines the soundness boundary for `restrict`/LLVM `noalias`-style metadata, preserves provenance through spans/arrays/views, and adds mixed-site cloning so numerical loops no longer need raw-pointer/manual C escape hatches to expose disjointness.

Co-authored-by: godofecht <[email protected]>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

compiler/bootstrap: took main's, then bootstrap_from_c.sh --regen (fixed
point at gen3 on macOS; Linux x86-64 ELF rebuilt on the box). Checked-in
flowc_stage_a is Linux x86-64 like main's.

Also normalize em dashes in docs/language/cold-start.md and
compiler/src/main.flow so the pre-commit prose check passes (those came
from main).
Build wiki required language/noalias.md in docs/nav.json. The Pair field
provenance example used a non-primitive module static; move it into a
function so doc_examples accepts it.
Catch up after #1409. Only compiler/bootstrap/flowc_stage_a conflicted.
Took main's bootstrap and re-ran bootstrap_from_c.sh --regen (fixed point
at gen3; C unchanged vs prior tip). Checked-in flowc_stage_a is the Linux
x86-64 ELF.
doc_examples rejected fn as a parse error; Flow spells it function.
parity_mlir --record after the #731 noalias emitter changes (206
corpus digests). Also run ./flow tool demo_nav so docs/nav.json
matches the demo catalog.
@godofecht
godofecht marked this pull request as draft October 6, 2026 20:05
Record the new tests/lang/test_noalias_overflow.flow golden after the
overflow-safe interval arithmetic commits on this branch.
bootstrap_from_c.sh --regen reached fixed point at gen2. Checked-in
flowc_stage_a rebuilt as Linux x86-64 ELF. Fixes self-host roundtrip
bootstrap drift.
Resolve bootstrap binary by taking main then regenerating.
Regenerated bootstrap C on Mac (fixed point gen2) and rebuilt the
checked-in ELF on Linux for CI self-host.
@godofecht
godofecht merged commit 7cd0ce3 into main Oct 6, 2026
41 checks passed
godofecht added a commit that referenced this pull request Oct 6, 2026
Bootstrap binary and corpus digests taken from main; will regen and re-record.
godofecht added a commit that referenced this pull request Oct 6, 2026
Rebuild Linux ELF and refresh corpus digests for the schema-salt
parse-cache branch on current main.
godofecht added a commit that referenced this pull request Oct 6, 2026
Take main bootstrap binary then regenerate for cgen overlap-copy changes.
godofecht added a commit that referenced this pull request Oct 7, 2026
…om closed PRs

Salvaged from closed pull requests whose code already landed:

- #1360 (region inference, code merged as #1390): region-inference.md,
  the tests/cgen region_inference and region_unproven goldens, and the
  spec, book, spans, lifetime-domains, README, spec-index, nav and
  CHANGELOG lines.
- #1368 (noalias, code merged as #1388): the spans.md paragraph on
  restrict .data temporaries and its noalias.md link.
- #1380 (tail-resumptive effects, code merged as #1349): the spec-index
  row for effects-continuations.md.

#1417 landed after #1360 and keeps an unproven forward copy as an
ordered element loop. The region_inference golden and the docs now say
that, in place of the memmove the closed branch expected. The golden
fails on the pre-#1417 compiler, which emitted memmove.
@godofecht
godofecht deleted the fix-731-13751263526198508203 branch October 12, 2026 23:02
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.

[Performance #727] Emit proven noalias/restrict information in C and MLIR backends

1 participant