Skip to content

gen-c: cast_iN(x) is a cast, not a call - #3498

Merged
gHashTag merged 1 commit into
masterfrom
c/cast-builtin
Sep 8, 2026
Merged

gen-c: cast_iN(x) is a cast, not a call#3498
gHashTag merged 1 commit into
masterfrom
c/cast-builtin

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 8, 2026

Copy link
Copy Markdown
Owner

gen-c: cast_iN(x) is a cast, not a call

Closes #3497

Last pass proposed a cheap audit: re-read every "impossible" this
campaign has written down, and open one member in the SOURCE before
believing the label. Five labels, one grep each.

cast_i8 "a name nothing declares" -> blocked REFUTED (fixed here)
the OP_* lists "name no single enum" REFUTED (typed consts)
[T] "a language-surface decision" NARROWED
POS/NEG "appear nowhere in the specs" HELD
the slice half of len "needs a representation" HELD

THE ZIG BACKEND HAS LOWERED cast_i8 SINCE W570 -- @as(i8, @intCast(v))
-- and its own comment records the very fact this campaign used as the
blocker: "cast_i8( alone appears 1,100 times and is defined nowhere in
the corpus". Declared nowhere was true. THEREFORE UNFIXABLE WAS NOT: it
is a typed cast spelling with a lowering already written in one backend,
and C is the one without an answer -- the fifth instance in this
campaign of that pattern.

cast_i8 1079 uses
cast_i16 38
cast_i32 2

MEASURED, whole corpus, -ferror-limit=0:
errors 11 042 -> 10 831 (-211)
files better/worse 9 / 0
igla_race_ternary_inference 123 -> 40
igla_race_ternary_gemm 296 -> 220
igla_race_systolic_array 122 -> 109

MIRRORS ZIG'S ARM EXACTLY: integers only -- a float cast is a different
conversion and choosing silently between them is a semantic decision,
not a lowering; guarded by the declared functions, so a spec defining
its own fn cast_i8 keeps it; arity one.

The width-suffix test moved from a method on the Zig codegen to a FREE
FUNCTION both backends call. A second copy is how one backend grows a
spelling the other refuses -- which is the defect this pass repairs.

Not repaired, filed: the OP_* refutation. 20 sites whose elements are
pub const OP_X : u8, so the element type is u8 and the annotation is
right there.

A mutant anchor matched twice -- the same line exists in the Zig arm --
and the harness printed ANCHOR FAILED -- NOT A VERDICT rather than a
survivor. That refusal was built two passes ago after it reported a
false one; re-run with a C-specific anchor, the mutant dies.

Tests: 5 new, including one that asserts C and Zig lower the SAME
spelling so the shared helper cannot drift. Full suite 3558 passed 0
failed. Five mutants, all killed. 9 stale seals refreshed.

🤖 Generated with Claude Code

Closes #3497

Last pass proposed a cheap audit: re-read every "impossible" this
campaign has written down, and open one member in the SOURCE before
believing the label. Five labels, one grep each.

  cast_i8 "a name nothing declares" -> blocked   REFUTED (fixed here)
  the OP_* lists "name no single enum"           REFUTED (typed consts)
  [T] "a language-surface decision"              NARROWED
  POS/NEG "appear nowhere in the specs"          HELD
  the slice half of len "needs a representation" HELD

THE ZIG BACKEND HAS LOWERED `cast_i8` SINCE W570 -- `@as(i8, @intcast(v))`
-- and its own comment records the very fact this campaign used as the
blocker: "`cast_i8(` alone appears 1,100 times and is defined nowhere in
the corpus". Declared nowhere was true. THEREFORE UNFIXABLE WAS NOT: it
is a typed cast spelling with a lowering already written in one backend,
and C is the one without an answer -- the fifth instance in this
campaign of that pattern.

  cast_i8   1079 uses
  cast_i16    38
  cast_i32     2

MEASURED, whole corpus, -ferror-limit=0:
  errors            11 042 -> 10 831   (-211)
  files better/worse     9 / 0
  igla_race_ternary_inference 123 -> 40
  igla_race_ternary_gemm      296 -> 220
  igla_race_systolic_array    122 -> 109

MIRRORS ZIG'S ARM EXACTLY: integers only -- a float cast is a different
conversion and choosing silently between them is a semantic decision,
not a lowering; guarded by the declared functions, so a spec defining
its own `fn cast_i8` keeps it; arity one.

The width-suffix test moved from a method on the Zig codegen to a FREE
FUNCTION both backends call. A second copy is how one backend grows a
spelling the other refuses -- which is the defect this pass repairs.

Not repaired, filed: the OP_* refutation. 20 sites whose elements are
`pub const OP_X : u8`, so the element type is `u8` and the annotation is
right there.

A mutant anchor matched twice -- the same line exists in the Zig arm --
and the harness printed `ANCHOR FAILED -- NOT A VERDICT` rather than a
survivor. That refusal was built two passes ago after it reported a
false one; re-run with a C-specific anchor, the mutant dies.

Tests: 5 new, including one that asserts C and Zig lower the SAME
spelling so the shared helper cannot drift. Full suite 3558 passed 0
failed. Five mutants, all killed. 9 stale seals refreshed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) September 8, 2026 13:26
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

This notebook contains session context, decisions, and artifacts for this work.

@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-08 13:26:39 UTC

Summary

Status Count
Total Open PRs 16
PRs with Failing Checks 13
PRs with All Checks Green 3
READY 2
FAILING 13
PENDING 0
NO CHECKS YET 0

These columns do not partition: 2 + 13 + 0 + 0 = 15, and there are 16 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=9f901833c3eb != manifest seal=87e5cbd3ad94.
    The committed NMSE numbers were certified against an older compiler.rs.
    Run scripts/reseal-check.sh locally for the two-step reseal command (advisory; not a merge gate).

@gHashTag
gHashTag merged commit 3699666 into master Sep 8, 2026
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gen-c: cast_iN(x) is a cast, not a call -- Zig has lowered it since W570 and its comment names the blocker

1 participant