Skip to content

claw: gates.t27 compares strings with str_eq and lengths, so gates.c has no literal pointer compares - #10703

Merged
gHashTag merged 1 commit into
masterfrom
claw-gates-literal-asserts
Oct 18, 2026
Merged

gHashTag merged 1 commit into
masterfrom
claw-gates-literal-asserts

Conversation

@gHashTag

Copy link
Copy Markdown
Owner

What

This finishes #10696. gen-c lowers == on str to a C pointer comparison (#8013). The regenerated gen/c/claw/gates.c still had 16 such compares, all in test functions. This PR rewrites them through text::str_eq with explicit lengths.

Test Before After
rows_stay_aligned_name_class_events NAMES[1] == want1, events_of(qp, 13) == ev_qp str_eq(NAMES[1], NAME_LENS[1], want1, 20), str_eq(events_of(qp, 13), events_len_of(qp, 13), ev_qp, 31)
unknown_name_is_unknown_and_not_blocking events_of("no-such-gate", 12) == "" events_len_of("no-such-gate", 12) == 0
audit_prefixes_name_the_problem_kind spec_only == "SPEC-ONLY ", ok == "", ... str_eq(LINE_PREFIX[k], PREFIX_LENS[k], "...", n), PREFIX_LENS[P_OK] == 0
soft_gates_report_their_events events_of("oracle-nightly", 14) == "..." str_eq(events_of(..), events_len_of(..), "...", 26)

New production function: events_len_of(name, name_len) -> usize, which returns EVENT_LENS[i] for a known name and 0 otherwise. New test: events_len_of_answers_every_row drives all 67 rows through it.

Verification (Railway lab)

  • t27c test-report and t27b: gates 24/24 (23 before, 1 new), gates_pins 6/6, service 8/8, preview 19/19, verified/gen_file_check 12/12. 0 vacuous passes.
  • cc -Wall "comparison with string literal" warnings on gates.c: 16 before, 0 after. All warnings: 107 before, 91 after.
  • 9 negative controls, 9 caught:
    • an expected prefix one byte shorter;
    • a one-byte change in a soft row's expected events;
    • a name compared against the wrong row;
    • events compared against the wrong row;
    • a one-byte change in the drift tail;
    • a drift-tail length off by one;
    • events_len_of reading NAME_LENS instead of EVENT_LENS;
    • its sentinel set to 1;
    • its bound set to 0..66.
  • My first drift-tail control was itself broken: the sed also edited the DRIFT_TAIL constant, so it survived. Rerun on the test line only, it was caught.
  • The gate-topology printf harness on the real .github/workflows listing prints claw: matrix is current and exits 0.
  • seal --save for gates, then seal --verify: 32 of 32 match.

Left, emitter-side (Rust, not touched)

The 91 warnings that remain on gates.c are all emitter defects: 70 incompatible-pointer-types, 16 discarded-qualifiers and 5 duplicate-decl-specifier. The last is #10645.

Closes #10698

🤖 Generated with Claude Code

…has no literal pointer compares

gen-c lowers `==` on str to a C pointer comparison (#8013). After #10696 the
regenerated gen/c/claw/gates.c still had 16 such compares, all in test
functions. Each string assertion now goes through text::str_eq with explicit
lengths. The new events_len_of(name, name_len), which returns EVENT_LENS[i] or 0
for an unknown name, replaces `events_of(x) == ""`. A new test drives all 67 rows
through events_len_of.

gen/c/claw/gates.c is regenerated by t27c gen-c.

Closes #10698

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag
gHashTag enabled auto-merge (squash) October 18, 2026 22:53
@github-actions

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-18 22:54:25 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 45
PRs with All Checks Green 5
READY 4
FAILING 45
PENDING 0
NO CHECKS YET 0

These columns do not partition: 4 + 45 + 0 + 0 = 49, and there are 50 open PRs. A PR is being counted twice or not at all.

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=fad12492937a != 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 5971770 into master Oct 18, 2026
35 checks passed
gHashTag added a commit that referenced this pull request Oct 19, 2026
…Refs #10547)

gen/c/claw/gates.c: take the base side. The merged specs/claw/gates.t27 is
the base's (#10703), and t27c gen-c on the lab reproduces the base's file
byte for byte (sha256 1c26e54b...).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

claw: 16 test-only string-literal comparisons in gates.t27 lower to C pointer compares in gen/c/claw/gates.c

1 participant