Skip to content

[anneal] Model Tier 1 scalar ops, casts, tuples, and Assert/UnwindResume - #3960

Open
joshlf wants to merge 1 commit into
joshlf-anneal-fuchsia-0f-starnix-symexecfrom
joshlf-anneal-p2-t1a-mir
Open

joshlf wants to merge 1 commit into
joshlf-anneal-fuchsia-0f-starnix-symexecfrom
joshlf-anneal-p2-t1a-mir

Conversation

@joshlf

@joshlf joshlf commented Nov 20, 2026

Copy link
Copy Markdown
Member

Human review surface

Extend Trusted.MirAst, Trusted.MirSemantics, Pass 2 Miri correspondence,
Anneal.MirWp, and bundled resources for Phase 2 Tier 1 scalar/control-flow
semantics:

  • Scalar ops: Div, Rem (truncation-toward-zero + div-by-zero / INT_MIN/-1 UB),
    AddWithOverflow, SubWithOverflow, MulWithOverflow, UnOp.{not,neg}, and
    CastKind.intToInt across bool and signed/unsigned integer widths.
  • Tuples and places: MirTy.tuple, SlotVal partial-init/move tracking, Place
    with ProjectionElem.field, AggregateKind.tuple with field-by-field
    writeAggregateTuple (corresponding directly to Miri.Interpreter.writeAggregate),
    and fail-closed assignHasUnsupportedOverlap for destination-overlapping tuple
    aggregates and non-ZST tuple self-copy/self-move.
  • Control flow: Assert (with operand-free AssertKind + UnwindAction),
    UnwindResume, and BasicBlock.cleanup with TerminalOut.unwound.
  • Pass 2 correspondence: independent M_ref modeling against vendor/lean-miri
    (25 required Miri primitives, 56 forbiddenAnneal helpers, 36 Pass 2 claims)
    with 6 new non-vacuity canaries (D14-D19) and updated boundary audit / test
    fixtures.

Layer 9 of 19 in the migrated Anneal verification stack under anneal/.

Public Anneal source checkpoint.

Authored by an AI agent acting on joshlf's behalf.

Extend Trusted.MirAst, Trusted.MirSemantics, Pass 2 Miri correspondence,
Anneal.MirWp, and bundled resources for Phase 2 Tier 1 scalar/control-flow
semantics:
- Scalar ops: Div, Rem (truncation-toward-zero + div-by-zero / INT_MIN/-1 UB),
  AddWithOverflow, SubWithOverflow, MulWithOverflow, UnOp.{not,neg}, and
  CastKind.intToInt across bool and signed/unsigned integer widths.
- Tuples and places: MirTy.tuple, SlotVal partial-init/move tracking, Place
  with ProjectionElem.field, AggregateKind.tuple with field-by-field
  writeAggregateTuple (corresponding directly to Miri.Interpreter.writeAggregate),
  and fail-closed assignHasUnsupportedOverlap for destination-overlapping tuple
  aggregates and non-ZST tuple self-copy/self-move.
- Control flow: Assert (with operand-free AssertKind + UnwindAction),
  UnwindResume, and BasicBlock.cleanup with TerminalOut.unwound.
- Pass 2 correspondence: independent M_ref modeling against vendor/lean-miri
  (25 required Miri primitives, 56 forbiddenAnneal helpers, 36 Pass 2 claims)
  with 6 new non-vacuity canaries (D14-D19) and updated boundary audit / test
  fixtures.

Source: https://github.com/joshlf/anneal/tree/7be4df1c99bed562d63afdb7242572b3381b37f7
Agent-authored-by: AI agent acting on joshlf's behalf
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T15:42:10.842405Z f04eced PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f04eced344

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +2234 to +2236
if expected == b then
jumpToBlock { frame with locals := localsAfterCond } callerMem target
else if !isOperandFreeAssertKind msg then

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Honor disabled optional overflow assertions

When using the repository's capture profile, trusted/rustc-capture/src/capture.rs:909 passes -Coverflow-checks=no, so rustc treats optional OverflowNeg and add/sub/mul/shl/shr assertions as a goto after evaluating cond. This branch instead unwinds whenever cond != expected, allowing verified Behavior to differ from the compiled binary. The proposed producer-side lowering is also incompatible with the required direct 1:1 MIR capture; model the compiler setting or reject these assertions instead.

AGENTS.md reference: anneal/AGENTS.md:L245-L249

Useful? React with 👍 / 👎.

before evaluating any operand or writing `dst`. -/
noncomputable def assignHasUnsupportedOverlap (dst : Place) (dstTy : MirTy) :
Rvalue → Bool
| .use opnd => isTupleTy dstTy && operandMayOverlapPlace dst opnd

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude ZST tuples from the overlap rejection

For a supported all-ZST tuple such as .tuple [.unit], a self-copy or self-move reaches this condition and faults as unsupported solely because isTupleTy is true. Zero-sized copies have no byte range to overlap—the vendored memory-copy path explicitly short-circuits zero-sized accesses—so this rejects valid MIR despite the change's stated guard being for non-ZST tuple self-copies. Test tuple size/layout rather than rejecting every tuple type.

AGENTS.md reference: anneal/AGENTS.md:L216-L220

Useful? React with 👍 / 👎.

@joshlf
joshlf added this pull request to stack #3976 November 20, 2026 17:58

This branch has not been deployed

No deployments
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.

1 participant