issue(0138): @const address-of yields wild pointer; ASM output-to-const BLOCKED

Filed issues/0138: `@const` (address-of a `::` comptime constant) lowers
to `inttoptr (i64 <value> to ptr)` — segfaults on deref, invalid store for
asm `-> @const`. Root cause in src/ir/lower/expr.zig .address_of (not asm).
Marked CHECKPOINT-ASM Next step BLOCKED on 0138 for the output-to-const
rejection item.
This commit is contained in:
agra
2026-06-15 23:18:37 +03:00
parent 97a4050462
commit c760b92548
2 changed files with 128 additions and 2 deletions

View File

@@ -213,8 +213,17 @@ Phase EF feasibility already confirmed against the live tree
`extern`, 60 sites; `--target` a global CLI flag).
## Next step
Inline assembly is **feature-complete for the common surface** plus read-write
(`+`) place outputs. Remaining work, all optional / additive (pick any):
**BLOCKED on issue 0138** for the output-to-`const` rejection item. Starting that
item surfaced a general (non-asm) compiler bug: `@const` (address-of a `::`
comptime constant) reinterprets the const's *value* as a pointer
(`inttoptr (i64 40 to ptr)`) → segfault on deref / invalid store for asm
`-> @const`. Root cause is in `src/ir/lower/expr.zig`'s `.address_of` path, not
the asm code; fixing it gives the asm `-> @place`-to-const rejection for free.
Filed `issues/0138-address-of-comptime-const-yields-wild-pointer.md`. Do NOT
implement an asm-only workaround — wait for the address-of fix.
Other remaining work is unaffected by 0138 and can proceed independently once
0138 is resolved (all optional / additive):
- **Indirect-memory (`"=*m"`) outputs**: pass the place address as an arg, asm
writes through it (no return slot). Currently rejected.
- **Output-to-`const` rejection** for `-> @place` (the place must be mutable).
@@ -281,6 +290,12 @@ Orthogonal: **issue 0137** (no-`main` segfault).
aarch64 example (`"=r,0"` IR). `zig build test` green (658 corpus, 446 unit).
## Known issues
- **0138** — `@const` (address-of a `::` comptime constant) yields a wild pointer
(`inttoptr (i64 <value> to ptr)`): segfaults on deref, invalid store for asm
`-> @const`. General address-of bug in `src/ir/lower/expr.zig` `.address_of`,
not asm-specific. **BLOCKS** the ASM "output-to-`const` rejection" item (fixing
0138 gives that rejection for free). Filed
`issues/0138-address-of-comptime-const-yields-wild-pointer.md`.
- **0137** — `sx run` on a program with no `main` segfaults (unguarded JIT entry
lookup, `src/target.zig:256-273`). Pre-existing, asm-independent. Filed
`issues/0137-jit-run-no-main-segfault.md`. Does not block A.1.