From 9e7661b91514af7e9f5c1c9900d4b8ebb8291172 Mon Sep 17 00:00:00 2001 From: agra Date: Tue, 16 Jun 2026 06:30:22 +0300 Subject: [PATCH] =?UTF-8?q?docs(asm):=20checkpoint=200138=20resolved=20?= =?UTF-8?q?=E2=80=94=20output-to-const=20rejection=20done?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- current/CHECKPOINT-ASM.md | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/current/CHECKPOINT-ASM.md b/current/CHECKPOINT-ASM.md index dce5ec9..f6f180f 100644 --- a/current/CHECKPOINT-ASM.md +++ b/current/CHECKPOINT-ASM.md @@ -213,17 +213,16 @@ Phase E–F 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 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 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.