gen-c: cast_iN(x) is a cast, not a call - #3498
Merged
Merged
Conversation
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
enabled auto-merge (squash)
September 8, 2026 13:26
Contributor
|
📓 NotebookLM Notebook linked to this PR
This notebook contains session context, decisions, and artifacts for this work. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_i8SINCE 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 inthe 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_i8keeps 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 isu8and the annotation isright there.
A mutant anchor matched twice -- the same line exists in the Zig arm --
and the harness printed
ANCHOR FAILED -- NOT A VERDICTrather than asurvivor. 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