Skip to content

gen-c: put the brackets after the name in a module array constant - #3458

Merged
gHashTag merged 1 commit into
masterfrom
parity/round-six
Sep 8, 2026
Merged

gen-c: put the brackets after the name in a module array constant#3458
gHashTag merged 1 commit into
masterfrom
parity/round-six

Conversation

@gHashTag

@gHashTag gHashTag commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Closes #3457

const A : [4]u8 = [1,2,3,4];
static const [4]u8 A = { 1, 2, 3, 4 };
error: brackets are not allowed here; to declare an array, place the brackets after the identifier

The mutable twin four lines above the site the probe found had the same
defect (var A : [4]u8static [4]u8 A), and only a grep for every
declarator-building site turned it up. A slice constant was broken before
either: static const []u8 A, where T name[] = { … } is legal C.

Fourth position for one rule

position declarator issue
parameter T x[static N] #3435
struct field T f[N]; #3446
local T x[N]; #3448
module const / var T name[N] this

Built from the field helper, not a fourth copy.

Measured — whole corpus, -ferror-limit=0

before after
errors 15126 15021
files that compile 301 302
files better 11

math/e8_lie_algebra 44 → 4 · fpga/mac 101 → 85 · queen/lotus 29 → 16 ·
boards/xc7a100t_minimal 11 → 1.

One file's count rose and it is not a regression. isa/registers goes
34 → 44 because the declarations now parse: what disappears is brackets are not allowed here and two expected ';'; what appears behind them is semantic
(TernaryWord{.raw=0} is not C — a separate defect the cascade was hiding). A
raw error count is not monotone under a repair that fixes a parse error.

Two things I got wrong, both caught here

My own test asserted something that never existed — that a slice const must
keep "the old pointer lowering". There was no pointer lowering; the type went
through verbatim. The test was wrong and the code was wrong, and the failing
test showed both.

A mutant survived and the answer was to delete. A has_init parameter
guarded a case neither caller can produce. A guard nothing can reach is not
protection, so it is removed rather than annotated.

mutant dead tests
const site reverted 3
var twin reverted 1
has_init check removed 0 — unreachable, parameter deleted

Full suite: 2630 passed, 0 failed. 28 seals refreshed in the same commit.

The round

Round six of tools/backend_parity_table.py — the const-initialiser position
it had never covered. Round five found only latent defects; this one found a
live one on its first form, so the table does not stop yet.

Closes #3457

    const A : [4]u8 = [1,2,3,4];
    static const [4]u8 A = { 1, 2, 3, 4 };
    error: brackets are not allowed here; to declare an array, place the
           brackets after the identifier

The MUTABLE TWIN four lines above the site the probe found carried the same
defect -- `var A : [4]u8` gives `static [4]u8 A` -- and only a grep for every
site that builds a declarator from a type and a name turned it up. A slice
constant was broken before either: `const A : []u8` gave `static const []u8 A`,
where `T name[] = { ... }` is legal C and takes its size from the list.

Fourth position for one rule, built from the field helper rather than a fourth
copy of it:

    parameter      T x[static N]    #3435
    struct field   T f[N];          #3446
    local          T x[N];          #3448
    module const   T name[N]        here

MEASURED, whole corpus, -ferror-limit=0:

    errors              15126 -> 15021
    files that compile    301 ->   302
    files better           11

`math/e8_lie_algebra` 44 -> 4, `fpga/mac` 101 -> 85, `queen/lotus` 29 -> 16.

ONE FILE'S COUNT ROSE AND IT IS NOT A REGRESSION. `isa/registers` goes 34 -> 44
because the declarations now PARSE: the errors that disappear are `brackets are
not allowed here` and two `expected ';'`, and what appears behind them is
semantic -- `TernaryWord{.raw=0}` is not C, a separate defect the parse cascade
had been hiding. A raw error count is not monotone under a repair that fixes a
parse error; the per-file split is what makes that visible.

MY OWN TEST ASSERTED SOMETHING THAT NEVER EXISTED. It required a slice const to
keep "the old pointer lowering", and there was no pointer lowering -- the type
went through verbatim. The test was wrong AND the code was wrong, and the test
failing is what showed both.

A MUTANT SURVIVED AND THE ANSWER WAS TO DELETE. A `has_init` parameter guarded
a case neither caller can produce, so the mutant deleting its check changed
nothing. A guard nothing can reach is not protection: the parameter is removed
rather than annotated. Two other mutants died.

Round six of the parity table, the const-initialiser position it had never
covered. The previous round found only latent defects; this one found a live
one on its first form, so the table does not stop yet.

28 seals refreshed in the same commit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) September 8, 2026 03:21
@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 03:21:51 UTC

Summary

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=b54395593fd7 != 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 83bd614 into master Sep 8, 2026
28 of 32 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: a module-level array constant puts its brackets before the name

1 participant