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
Audit source field ownership and LLVM layout registry mappings #1131
Nested generic record registration can corrupt field ownership in the LLVM layout registry while MIR validation succeeds.
Reproduction:
type Inner[T] { value: T }
type Outer[T] { left: i32, inner: Inner[T], right: i32 }
fn create() -> Outer[i32]: Outer { left: 11, inner: Inner { value: 22 }, right: 33 }
fn main:
let value = create()
assert(value.inner.value == 22)
At Phase 1 commit 72e1067, this fails LLVM verification: icmp eq %Outer__i32 ..., i32 22. An owning Trie variant with pointer fields instead compiles, overwrites its engine pointer with null, and traps at main + 136.
Native proof: LLDB stops in Codegen.monomorphize_struct_nodes + 2184, resolving the child's type recursively while the parent's flat field range is incomplete. Codegen.get_llvm_field_index receives source index 1 and returns 0 from the registry map. Codegen.w records struct_field_starts before recursively resolving fields and appends mapping entries after resolving them, interleaving parent and child ranges.
The implementation fix reserves complete parallel field ranges before recursion. The remaining tooling gap is that check --validate-all --dump-mir succeeds for the Trie variant: no check compares the registry's field ownership and slot mapping with the source record. Add a codegen layout audit that catches overlapping field ranges, inconsistent parallel columns, and incorrect source-to-LLVM field mappings before emitting stores. The ordinary LLVM verifier catches mismatched types but cannot detect two same-typed pointer fields being confused.
Local evidence: out/phase1-drafts/nested-layout-registry-proof.txt, trie-native-proof.txt, and trie-pre-ir.txt in the c-algorithms-phase1 worktree. No workaround is used in the facade; the compiler layout registration is being fixed in the Phase 1 batch.
Activity
stdlib sourcing Phase 1: the c-algorithms corpus, its upstream tests,…
C algorithms phase1 (#1142)
ehartford commentedon Oct 25, 2026
Triage 2026-10-25,
with v0.15.3.0(main a261b65): does not reproduce.