docs(asm): checkpoint 0138 resolved — output-to-const rejection done

This commit is contained in:
agra
2026-06-16 06:30:22 +03:00
parent 2a954ceeb6
commit 9e7661b915

View File

@@ -213,17 +213,16 @@ Phase EF feasibility already confirmed against the live tree
`extern`, 60 sites; `--target` a global CLI flag).
## Next step
**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.
The output-to-`const` rejection item is **DONE** (via issue 0138, now RESOLVED).
The general `@const` address-of bug — `@scalar_const` reinterpreting the folded
value as a pointer (`inttoptr (i64 40 to ptr)`) → segfault on deref / invalid
store for asm `-> @const` — was fixed in `src/ir/lower/expr.zig`'s `.address_of`
path (scalar `::` consts now diagnose "no storage"; array/struct consts keep real
storage). Because asm `-> @place` lowers `@place` through that same path, asm
`-> @const` now reports the clean diagnostic for free — no asm-specific code
needed. Regression: `examples/1177-diagnostics-addr-of-const-rejected.sx`.
Other remaining work is unaffected by 0138 and can proceed independently once
0138 is resolved (all optional / additive):
Remaining work, 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).
@@ -288,14 +287,20 @@ Orthogonal: **issue 0137** (no-`main` segfault).
`asmIsReadWrite` helper. Lowering stops rejecting `+` (`*` still rejected). Two
commits (cadence): 1650 locked the rejection, then flipped to a runnable
aarch64 example (`"=r,0"` IR). `zig build test` green (658 corpus, 446 unit).
- (0138) output-to-`const` rejection — fixed the underlying general bug: scalar
`@const` (address-of a folded `::` constant) reinterpreted the value as a
pointer (`inttoptr`). `src/ir/lower/expr.zig` `.address_of` now diagnoses a
scalar const (local + module) instead of falling through; array/struct consts
keep storage. asm `-> @const` gets the clean diagnostic for free (same path).
Regression `examples/1177-diagnostics-addr-of-const-rejected.sx`. Issue 0138
RESOLVED. `zig build test` green (659 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`.
- **0138** — RESOLVED. `@const` (address-of a `::` comptime constant) yielded a
wild pointer (`inttoptr (i64 <value> to ptr)`). Fixed by diagnosing scalar
`@const` in `src/ir/lower/expr.zig` `.address_of` (no storage; array/struct
consts unaffected). Delivered the ASM "output-to-`const` rejection" for free.
Regression `examples/1177-diagnostics-addr-of-const-rejected.sx`.
- **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.