Skip to content

The C tests handed cc a clang-only flag: 23 red on gcc, and the silent half compiled nothing - #4551

Open
gHashTag wants to merge 2 commits into
masterfrom
fix/cc-error-limit-flag
Open

gHashTag wants to merge 2 commits into
masterfrom
fix/cc-error-limit-flag

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

Closes #4542

The defect

Fifteen bootstrap/tests/c_*.rs files each carried a hand-copied argument list
containing -ferror-limit=0. That is a clang flag. CI runs Ubuntu, where
cc is gcc, and gcc refuses it:

cc: error: unrecognized command-line option '-ferror-limit=0'

It breaks the two assertion shapes in opposite directions:

shape on gcc verdict
assert!(!stderr.contains("error")) the refusal contains "error" fails — the 23 the ratchet reports
errors() filtering file:line:col: error: cc: error: has no line:col → count 0 passes, having compiled nothing

The second half is the worse one, and it was invisible. Green there meant the C
backend was untested, not correct.

The fix

One place decides, replacing fifteen copies — bootstrap/tests/common/mod.rs
probes cc once with an empty translation unit and takes -ferror-limit=0,
else -fmax-errors=0 (gcc's spelling of the same thing), else neither. A
missing flag must never read as a broken header, and the flag is not
decoration: clang stops after 20 errors and these tests assert over the whole
diagnostic set.

c_static_array_params was never about the flag — it names clang's
-Warray-bounds, and the CI log shows its got: followed by an empty line.
Measured on both compilers:

compiler flags result
clang -fsyntax-only [-Warray-bounds]
gcc -fsyntax-only silence — no analysis pass runs
gcc -c, even at -O0 [-Wstringop-overflow=]

Both the flag set and the warning name differ, so it now asks instead of
naming: a hand-written undersized [static 4] call plus a correctly-sized
control, take the tag the first provokes and the second does not, then demand
that tag of the generated header. The control is what stops it selecting a tag
that fires on everything. It panics rather than skips when no candidate works —
this file exists to prove the spelling CHECKS something.

scripts/ci/check-cc-args.mjs keeps the choice in one place. It runs in the
ratchet job, which already watches bootstrap/**, and was verified to fail on a
deliberately reintroduced copy.

Verified

Against a real gcc 15 standing in as cc, from a clean master base:
19 targets, 109 tests, 0 failures. All 7 previously-failing targets green.

gcc's genuine errors do match the file:line:col: error: shape, so the
previously-vacuous files now check for real rather than merely stopping being
red.

Census

tools/census/shell.txt moves run: steps 275 → 276 and "the runner does"
254 → 255 — the one gate step this PR adds. No other census moved.

… passed by not compiling

Fifteen `bootstrap/tests/c_*.rs` files each carried a hand-copied

    .args(["-std=c11", "-ferror-limit=0", "-fsyntax-only", "-x", "c"])

`-ferror-limit=` is clang's. CI runs Ubuntu, where `cc` is gcc, and gcc
refuses it:

    cc: error: unrecognized command-line option '-ferror-limit=0'

That breaks the two assertion shapes in OPPOSITE directions. Files asserting
`!stderr.contains("error")` fail, because the REFUSAL contains the word --
23 tests, reported by the ratchet as "the failing set grew by 23". Files
counting `file:line:col: error: ` lines pass, because `cc: error:` has no
line:col, so the count is zero and nothing was ever compiled. Green there
meant the C backend was untested, not correct, and that half was invisible.

The flag is not decoration -- clang stops after 20 errors and these tests
assert over the whole diagnostic set -- so it is chosen, not dropped.
`bootstrap/tests/common/mod.rs` probes `cc` once with an empty translation
unit and takes `-ferror-limit=0`, else `-fmax-errors=0` (gcc's spelling of
the same thing), else neither. A missing flag must never read as a broken
header.

`c_static_array_params` was never about the flag. It asserts the diagnostic
names `-Warray-bounds`, which is clang's name, and the CI log shows its
`got:` followed by an empty line. Measured on both compilers:

    clang  -fsyntax-only     -> [-Warray-bounds]
    gcc    -fsyntax-only     -> silence; it runs no analysis pass
    gcc    -c, even at -O0   -> [-Wstringop-overflow=]

Both the flags and the name differ, so it now asks instead of naming: a
hand-written undersized `[static 4]` call plus a correctly-sized control,
take the tag the first provokes and the second does not, then demand that
tag of the generated header. The control is what stops it selecting a tag
that fires on anything. It panics rather than skips when no candidate works
-- this file exists to prove the spelling CHECKS something.

`scripts/ci/check-cc-args.mjs` keeps the choice in one place, and runs in the
ratchet job, which already watches `bootstrap/**`.

Census: tools/census/shell.txt moves `run: steps` 275 -> 276, and "the
runner does" 254 -> 255. That is the one gate step added by this commit; no
other census moved.

Verified with a real gcc 15 standing in as `cc`, from a clean master base:
19 targets, 109 tests, 0 failures. gcc's genuine errors DO match the
`file:line:col: error: ` shape, so the vacuous files now check for real
rather than merely stopping being red.

Refs #4542

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-21 14:32:43 UTC

Summary

Status Count
Total Open PRs 26
PRs with Failing Checks 20
PRs with All Checks Green 6
READY 2
FAILING 20
PENDING 0
NO CHECKS YET 1

These columns do not partition: 2 + 20 + 0 + 1 = 23, and there are 26 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=403499176a5d != 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).

…alone

Refs #4542

`tri harness scratch` caught it: every test in a binary shares one pid,
so `t27-cc-flags-{pid}` is one directory for four tests -- and the test
that uses it deletes the whole thing on the way out. Nothing has gone
wrong yet because only one of the four writes there, but the gate judges
the key, not today's luck, and it is right to.

A counter AND the pid, which is the gate's own advice and not
belt-and-braces: the counter separates this binary's tests from each
other, and the pid separates two concurrent runs sharing $TMPDIR.

  tri harness scratch --gate  ->  114 files read, none
  cargo test --test cc_flags  ->  4 passed
@github-actions

Copy link
Copy Markdown
Contributor

📓 NotebookLM Notebook linked to this PR

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

@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-09-21 14:44:58 UTC

Summary

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

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=403499176a5d != 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 added a commit that referenced this pull request Sep 21, 2026
…mitted both (#4558)

Fixes #4557

`state_after` and `retry_allowed` were each declared twice in
specs/automation/crm-duet.t27, byte-identical down to the comment.

`t27c check` had been saying so all along -- "every backend rejects a
redeclaration" -- and it was right. What it did not do was stop
anything: the warning is not an error, `gen-c` exits 0, and the emitted
header carries both definitions.

  cc -std=c11 -fsyntax-only  before  ->  error: redefinition of 'state_after'
  cc -std=c11 -fsyntax-only  after   ->  that error is gone
  t27c check                 before  ->  0 errors, 2 warnings
  t27c check                 after   ->  0 errors, 0 warnings
  tools/dupe_scan.py         after   ->  no new duplicate, no known group grew

The deletion keeps the pair that sits with the module's other function
declarations. The spec's 12 tests are unchanged and still resolve.

This is master's red, not either open PR's: #4541 and #4551 both fail
`duplicate-bodies` on this file, which neither of them touches.
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.

The C-backend tests hand cc a clang-only flag: 23 red on gcc, and the ones that stay green check nothing

1 participant