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
Validate callable operand representation after reference projection #1133
check --validate-all --dump-mir accepts a call whose callee operand is &fn, while codegen invokes that pointer as if it were the stored function value. An indexed C callback array exposes it directly.
use std.libc.atoi
var callbacks: [2]extern "C" fn(*const i8) -> i32 = [atoi, null]
fn main: assert(callbacks[0](c"21".ptr) == 21)
Stage 1 built from e7ddf11 plus the borrowed-binding fix produces:
The call needs to project through _15 to read the callable. Native LLDB stopped at the data symbol callbacks (0x10000c000) with EXC_BAD_ACCESS/code=2. x9 held the array-slot address used as the branch target, while x8 already contained libc's valid atoi address. The caller was verify, the migrated callback-array fixture.
Root producer: MirBuilder.lower_call passed lower_expr(fn_expr) directly; D27 indexing correctly produced an exact &fn view, but the call did not load through that view. The Phase 1 change normalizes callable reference places in shared MIR call lowering and continues to consume FnAbi for arguments/results.
Track the validator gap separately: validate that indirect-call operands have an invocable physical value after reference projections, including raw C function pointers, With closure pairs, reference parameters and collection element views. A matching FnAbi signature alone does not establish that the operand holds a callable value.
Triage 2026-10-25, with v0.15.3.0 (main a261b65): does not reproduce. null is no longer a value of a non-optional fn pointer (§16.6), so the array holds two callables; calling through the indexed element works:
$ cat main2.w
use std.libc.atoi
var callbacks: [2]extern "C" fn(*const i8) -> i32 = [atoi, atoi]
fn main:
assert(callbacks[0](c"21".ptr) == 21)
print("ok")
$ with run main2.w
ok
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.nullis no longer a value of a non-optional fn pointer (§16.6), so the array holds two callables; calling through the indexed element works: