Repository navigation
Description
Repro (deterministic, seconds)
./out/release/bin/with analyze out/deep-debug-tool-tests/ownership-input.w audit:trait-tables # rc=139
./out/release/bin/with analyze out/deep-debug-tool-tests/ownership-input.w audit:codegen # rc=139
(The fixture is written by build.w's deep-debug-tool-tests action; any run of that lane regenerates it.) The seed passes both audits (rc=0) — this is a batch-window regression. All other audits pass except audit:receiver-surface (rc=1, pre-existing on the seed too — separate issue).
Blocks reseed: the deep-debug-tool-tests lane is the current red in the :test aggregate, after D23 known-issue dispositions took the spec lane green.
Evidence chain (lldb, release binary)
- Crash:
EXC_BAD_ACCESSinsideLLVMGetReturnType(ldr x8,[x0,#0x10]; ldr x0,[x8]— the deref of ContainedTys faults). Fault address varies per run (heap-layout dependent). - 37
create_dyn_wrappercalls; the crash is during Imported record types inside Vec fields can make len() hit an internal compiler error #37:__dynwrap_Resource_drop(the fixture'simpl Drop for Resource,move selfreceiver, consumes_self=1). Neitherdyn_impl_row_signorensure_concrete_mir_functionfires between Enum variant shorthand in generic arguments fails inside non-void helper functions #36 and Imported record types inside Vec fields can make len() hit an internal compiler error #37, so the wrapper'sftcomes from the plainfn_values/fn_fn_typesmap path (CodegenTraits.w:924-939). - At wrapper Imported record types inside Vec fields can make len() hit an internal compiler error #37 entry, the handles are VALID in the same run:
method_ft == dyn_ft,LLVMGetTypeKind == 9(FunctionType), an lldb-expr'dLLVMGetReturnType($x6)succeeds,LLVMCountParamTypes == 1. - The fatal call is CodegenTraits.w:360 (
lrsymbolicates tocreate_dyn_wrapper + 316), withx0equal to the entrydyn_ft— same handle, same run. Between fn entry and line 360 (intern resolves, name concat,wl_get_named_function,wl_count_param_types,wl_get_param, Vec pushes), the FunctionType object's interior pointer at[type+0x10]goes from dereferenceable to garbage: something overwrites LLVM-context-owned memory. WITH_DEBUG_ALLOC=1: ledger overflows on a full compiler run ("tracking truncated"), no verdict — the ledger needs a bigger capacity tier before it can arbitrate compiler-scale runs.- Guard Malloc (
DYLD_INSERT_LIBRARIES=/usr/lib/libgmalloc.dylib): no invalid-free trap, same crash — weakens the freed-then-reused theory; the overwrite comes from a writer that owns (or thinks it owns) a live allocation overlapping the type object.
Suspects
The write happens during the earliest statements of create_dyn_wrapper #37 (string concat + Vec[i64] pushes) — a With-side buffer whose bounds overlap the LLVM bump-allocated FunctionType. Candidate classes: a Vec buffer grown from a stale handle-copy header (pre-flip two-owner class — same family as the foundation-module double frees fixed in 96f1248), or an interior-pointer write from the intern/str layer. Next session: watchpoint on [dyn_ft+0x10] at wrapper #36/#37 boundary to catch the writer PC directly — that names the exact line.
Context
audit:codegen and audit:trait-tables force vtable/wrapper emission for ALL trait impls including Drop; normal codegen doesn't take this path for the fixture, which is why build/behavior lanes stay green.
Activity
ehartford commentedon Jul 26, 2026
Fixed in c750e7e. Root cause: analyze_codegen_backend's pre-flip take-and-alias pool handling — bare field reads became moves under #691, and assign-then-overwrite selection dropped a still-viewed InternPool; freed pages recycled into the LLVM context corrupted FunctionType interiors (hence valid-at-entry handles crashing in LLVMGetReturnType with 32-bit-truncated ContainedTys reads, per-run fault addresses, and Guard Malloc silence — the writer owned a live re-allocation). Fix: if-expression selection (no loser dropped), sema ast taken from inside cg, and take_pool/take_intern partners so the backend returns everything it lent. audit:trait-tables and audit:codegen rc 139->0; audit:all rc=0 on the rebuilt stage1.
Handoff: session tail — reseed blocked on #726/#727, evidence and nex…
Backend: take-and-return the pools lent to the analysis codegen run (#…
D22: mixed view/literal contextual joins take the payload width (#726 …
Handoff: v2 tail — #726 closed via join-width fix; reseed now blocked…
D22 #715: gate non-Copy Drop element copies out of Vec at owned demands