Skip to content

t27c gen-c: size_t range counter, refuse an integer switch without else (Closes #7307, Closes #7308) - #7331

Merged
gHashTag merged 14 commits into
masterfrom
claude/t27c-genc-for-switch-7307-7308
Oct 8, 2026
Merged

gHashTag merged 14 commits into
masterfrom
claude/t27c-genc-for-switch-7307-7308

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Closes #7307
Closes #7308

Part of #5980 (P1 of the self-host epic: t27core has to match gen-c byte for byte, so gen-c has to be right first).

What changes

#7307 -- range for counter. gen-c declared the counter of for (a..b) |i| as int. A range capture is a usize (Zig types it so), and gen-c spells usize as size_t. With int, a start bound above INT_MAX converted to a negative int and the loop ran zero times, and a count past INT_MAX overflowed (undefined behaviour). Both gen_c_for_stmt and gen_c_for_range_stmt now emit for (size_t .... The inclusive form (a..=b, lowered to a..(b + 1)) and the discarded capture (|_|, counter __t27_i) go through the same path.

#7308 -- integer switch without else. gen-c compiled switch (x) { 1 => 10, 2 => 20 } into (x == 1) ? (10) : (x == 2) ? (20) : 0, so an unmatched value quietly became 0. Zig rejects that program. Compiler::compile_c now refuses it before codegen with non-exhaustive switch in <fn>: a switch on an integer needs an else arm (labels 1, 2) ... (#7308). Because compile_c is the single entry point, gen-c, seal and the cc gate all refuse it. Rules:

  • An else arm or a _ arm counts as the catch-all. _ keeps specs/demos/jones_topology_decision_gate.t27 generating (its three numeric switches end in _ =>).
  • A switch is an integer switch if any label is an integer literal, a negative integer, or a char literal. Enum switches are not touched. The parser drops the dot of .variant, so an enum label cannot be told apart from a constant, and the corpus has 87 enum switches without else, each naming its variants. A scan of all specs/**/*.t27 found no switch the new check refuses: the corpus gen-c diff below has no exit-code changes.

Known and out of scope: gen-c emits (x == _) for a _ arm (it should be the fallthrough). It is a separate defect and is not touched here.

Repros, as t27 data, watched red then green

The repros are .t27 fixtures run by the existing bootstrap/tests/core_selfhost.rs harness. No new Rust test file:

  • bootstrap/tests/fixtures/core_selfhost/genc/for_counter.t27 -- for loops from a start bound of 4294967295 (|_|, |i|, ..=). The harness builds the gen-c output with cc -std=c99 and runs the spec's own test blocks. genc/ holds gen-c repros the core need not take yet: they are built and run, not compared with the core.
  • bootstrap/tests/fixtures/core_selfhost/genc/switch_exhaustive.t27 -- integer switches with else (including negative labels) and an enum switch naming every variant. All are accepted, built and run.
  • bootstrap/tests/fixtures/core_selfhost/both_refuse/switch_no_else{,_negative,_char}.t27 -- the issue repro, plus negative and char labels. gen-c and the core must both refuse each one. both_refuse/ joins the harness's existing BOTH_REFUSE list.

The harness change is +15/-7 lines: two directory reads, plus a flag that skips the core comparison for genc/.

All runs were on the Railway t27c lab, not a laptop:

  • This PR: core_selfhost 1/1 ok, and the unit test test_parse_for_range_c (expects size_t) ok.
  • Red A (master compiler.rs + FROZEN_HASH, same data): core_selfhost fails. genc/for_counter.t27's tests fail: count_from(BIG, 2) == 2, count_inclusive(BIG, 2) == 3, last_index(BIG, 2) == 4294967296.
  • Red B (master compiler.rs, genc/ emptied): core_selfhost fails with gen-c accepted a refused shape on the both_refuse/ repro.
  • The gen-c output of every spec in the corpus (1541) is byte-identical to this PR's earlier revision. The seals below therefore still hold.
  • Suite t27c suite --repo-root . --corpus-only --ratchet on the earlier revision: RATCHET CLEAN (77/77).

The runnable switch fixture builds no _ => arm. gen-c writes (x == _) for one, which C cannot compile; that is a separate defect, owned by the gen-c defects lane. The new check does treat _ as the catch-all, and specs/demos/jones_topology_decision_gate.t27 (three numeric switches ending in _ =>) still generates.

FROZEN_HASH and seals

bootstrap/stage0/FROZEN_HASH is updated to the new compiler.rs.

The gen-c output of 128 corpus specs changed. For each one, the lab checked that the master compiler's C, with every for (int replaced by for (size_t , is byte-identical to this PR's C. The new bytes are right because a range capture is a usize. No zig, rust or verilog output moved.

99 of those specs were sealed and current on master; they are resealed with t27c seal <spec> --save plus tri seals sync-twins. That is 200 seal JSON files including twins, and only gen_hash_c, sealed_at and recorded test results change.

specs/isa/ternary_shift.t27 was already sealed with --force, with the same two failing tests (ternary_shift_right_basic, ternary_arithmetic_shift_right_negative). It is resealed the same way and its tests block is unchanged.

After resealing, tools/check_seal_currency.py --stale-specs lists exactly the 14 specs it lists on master (the known baseline).

Coordination: PR #6994 also moves compiler.rs and FROZEN_HASH. Whichever lands second merges master and reseals.

Foreign-line budget (#7371)

This revision fits the budget that no label lifts: at most 40 hand-written foreign lines per file, 80 per PR.

  • Before: DENIED (exit 1). bootstrap/src/compiler.rs +64, bootstrap/tests/genc_for_counter.rs +112, bootstrap/tests/genc_switch_exhaustive.rs +125, and the PR total was over 80.
  • After: exit 0. bootstrap/src/compiler.rs +39/-3, bootstrap/tests/core_selfhost.rs +15/-7 (54 foreign lines), plus bootstrap/stage0/FROZEN_HASH +1/-1.
    • The two Rust tests and their two specs/compiler/genc_*.t27 specs are gone; their cases are the fixtures above.
    • compiler.rs loses two repeated comments, and the self-host: gen-c lowers a switch with no else arm to 0 for the missing case #7308 check builds one label list instead of three passes. Its behaviour is unchanged: the corpus gen-c bytes are identical.
    • tools/policy/foreign-exceptions.txt is back to master's version.

Checked with master's own gate (gen/c/policy/own_language.c, check_budget) on the lab, and by the lefthook foreign-budget hook on push.

All 128 corpus specs whose gen-c output changed, one line each
  • compiler/runtime/runtime.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/api/c_api_contract.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/base/ops.t27 -- 21 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/base/ternary_encoding.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/base/ternary_memory.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/base/types.t27 -- 46 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/bus/pubsub.t27 -- 9 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/bus/schema.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/cloud/railway_deploy.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/compiler/rust_value_parameters.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/config/load.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/config/migrate.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/config/paths.t27 -- 8 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/config/schema.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/enrichment/audio_overview.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/file/operations.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/git/operations.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/graph/knowledge_graph.t27 -- 7 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/igla/evaluation/multi_lang_harness.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/igla/training/low_bit_ternary.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/isa/ternary_arithmetic.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/isa/ternary_bitwise.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/isa/ternary_deque.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/isa/ternary_gates.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/isa/ternary_shift.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/lsp/protocol.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/lsp/schema.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/lsp/server.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/constants.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/gf_competitive.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/pellis_precision_verify.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/phi_split_optimality.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/phi_universal_attractor.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/property_test_template.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/radix_economy.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/math/sacred_physics.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/memory/formula_embed.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/memory/notebooklm.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/activation/gelu_activation.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/loss/contrastive_loss.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/ml/optimizer/lamb.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/ml/optimizer/lr_scheduler.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/ml/optimizer/sgd_momentum.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/ml/recurrent/gru_cell.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/recurrent/lstm_single.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/recurrent/rnn_cell.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/recurrent/seq2seq.t27 -- 8 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/rl/dqn_target_network.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/rl/ppo_clip_loss.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/rl/sac_critic.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ml/transformer/positional_encoding.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/neural/forward_pass.t27 -- 98 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/nn/attention.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/nn/hslm.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/numeric/bigint.t27 -- 9 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/formats.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/gf12.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/gf16.t27 -- 47 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/gf20.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/gf24.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/gf32.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/gf8.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/gfternary.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/goldenfloat_family.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/numeric/phi_ratio.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/numeric/tf3.t27 -- 30 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/physics/formula_discovery.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/physics/gamma_conjecture.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/physics/gi1_analysis.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/physics/sacred_verification.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/browseros/trios/agent-server/apps/server/src/api/routes/memory.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/fpga/vivado/matmul_serial_hw.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/scripts/gen_w312.t27 -- 10 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/scripts/gen_w379.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/tools/check_seal_currency.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/fpga/openxc7-synth/d_f19_test.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/fpga/openxc7-synth/d_slow_blink.t27 -- 9 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/src/tri/gen_gradient_descent.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/src/tri/gen_kmeans.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/src/tri/gen_mock.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/src/tri/gen_neuron.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/src/tri/gen_rle.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/src/tri/gen_softmax.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trinity/src/tri/gen_test_runner.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/port/trios/crates/trios-cli/src/cmd/submit.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/portable/relay_observer.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/provider/adapters.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/provider/schema.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/provider/stream.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/provider/transform.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/queen/brain_summaries.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/runtime/execute.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/runtime/instance.t27 -- 7 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/runtime/process.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/server/http.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/server/mdns.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/server/router.t27 -- 14 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/server/sse.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/server/vm.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/sync/index.t27 -- 10 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/sync/schema.t27 -- 7 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ternary/bigint.t27 -- 12 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/ternary/hybrid_bigint.t27 -- 36 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/test_framework/property_test_template.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/test_framework/verilog_bench_harness.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/collections/bitvector.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/collections/map.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/graph/graph_bfs.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/graph/topological_sort.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/math/bezier.t27 -- 3 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/math/matrix.t27 -- 7 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/math/polynomial.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/tri/math/statistics.t27 -- 7 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/search/bloom_filter.t27 -- 4 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/search/rabin_karp.t27 -- 5 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/sort/insertion_sort.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/sort/radix_sort.t27 -- 8 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/sort/selection_sort.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/t27b/conformance/repeat_addr_unreached.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (not sealed or already stale on master)
  • specs/tri/trees/b_tree.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/trees/segment_tree.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/utils/text.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/tri/utils/version.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/vsa/jones_polynomial.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/vsa/sdk.t27 -- 6 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/vsa/sequence_hdc.t27 -- 1 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/vsa/similarity_search.t27 -- 2 range loop(s), for (int -> for (size_t , nothing else (resealed)
  • specs/vsa/vsa_core.t27 -- 13 range loop(s), for (int -> for (size_t , nothing else (resealed)

🤖 Generated with Claude Code

gHashTag and others added 2 commits October 7, 2026 14:18
…ut else (Closes #7307, Closes #7308)

#7307: gen-c declared a range `for` counter as `int`. A range capture is a
`usize`, so the counter is now `size_t`; past INT_MAX the old counter
overflowed and a start bound above INT_MAX ran the loop zero times.

#7308: an integer switch with no `else` (or `_`) arm compiled to a C
conditional chain ending in `: 0`, so an unmatched value yielded 0 where
Zig refuses the program. compile_c now refuses it with
"non-exhaustive switch". Enum switches are unchanged.

Repros: specs/compiler/genc_for_counter.t27,
specs/compiler/genc_switch_exhaustive.t27, driven by
bootstrap/tests/genc_for_counter.rs and genc_switch_exhaustive.rs.

Part of #5980

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ounters (Refs #7307)

Every changed gen_hash_c was checked on the t27c lab: for each spec, the
master compiler's C with `for (int ` replaced by `for (size_t ` is
byte-identical to the fixed compiler's C. No zig, rust or verilog hash
moved. specs/isa/ternary_shift.t27 was already sealed with --force and
the same two failing tests; it is resealed the same way.

The inclusive-range test expects `(n + 1)`, which is how gen-c renders
the lowered bound.

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

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-07 07:31:35 UTC

Summary

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

These columns do not partition: 2 + 47 + 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)=42819ec580d9 != 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).

Conflicts: FROZEN_HASH is recomputed for the merged compiler.rs; the
foreign-exceptions blocks of #7090 and #7307/#7308 are both kept; the
18 conflicting seal files take master's side here and are regenerated
on the t27c lab in the next commit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…er (Refs #7307)

The master merge took master's side for 18 conflicting seal files. Under
this branch's compiler, 8 of those specs (16 files with their twins)
produce different gen-c, so the Railway t27c lab resealed them:
constants, phi_split_optimality, gf8, gf12, gf20, gf24, gf32, phi_ratio.
TriTopological's master seal already matches.

Lab check on the merge tree (6ae177d) vs master e45ba56:
- gen-c corpus: 132 of 1527 specs change, all only `for (int ` -> `for (size_t `; no exit-code change
- seal-currency stale list after reseal = master's 18, identical

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

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-07 08:33:07 UTC

Summary

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=5f6f711f495e != 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 commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

Merge shepherd: merged master c893f08 in from master's side (10629d2, a fast-forward of this branch). 17 seal files conflicted, and they were regenerated, not merged by hand. Master has not touched compiler.rs since the merge base 20d20c9, so FROZEN_HASH is unchanged: it is the sha256 of the merged compiler.rs. t27c was built from the merged tree on the t27c lab, with zig 0.16 on PATH. With it I ran t27c seal <spec> --save on the conflicted gf8, gf12, gf20, gf24, gf32, phi_ratio, phi_split_optimality, radix_economy and bot-topic-tabs. I also resealed conformance/undefined_arg.t27, which check_seal_currency.py --stale-specs named because #7801 sealed it with master's gen-c. Only gen_hash_c, built_by and sealed_at move. html, xml and terminal are left as master's ledgered debt. Results on the merged tree: check_seal_currency exits 0 (stale generated-code hash 0); check_seal_coverage is OK (1633 seals, 1512 hold, 121 known-broken, as in the baseline); tri seals twins gives 1628 / 548 / 31 disagree, the same as master; core_selfhost passes 1/1. Foreign-line budget: master's check_budget() allows it with compiler.rs +39 and core_selfhost.rs +15, 54 in total, and check_all() gives exit 0. The stale base.sha was cleared (#7489): auto-merge was off, the base was flipped to a temporary branch and back to master and checked, the ci label was added, the temporary branch was deleted, and then auto-merge was turned back on.

@gHashTag
gHashTag enabled auto-merge (squash) October 8, 2026 16:25
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-08 16:34:48 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 48
PRs with All Checks Green 2
READY 1
FAILING 48
PENDING 0
NO CHECKS YET 0

These columns do not partition: 1 + 48 + 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)=21a1173dfe32 != 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).

… master's side)

Master moved again; .trinity/seals/t27b_T27bLibm.json conflicted (master
resealed specs/tri/t27b/libm.t27). Regenerated, not merged by hand:

- FROZEN_HASH: master still has not touched compiler.rs since 20d20c9;
  the merged compiler.rs is this PR's and FROZEN_HASH is its sha256,
  unchanged.
- libm.t27 resealed with `t27c seal --save`, t27c built from this tree on
  the t27c lab, zig 0.16 on PATH (18/18 tests pass); only gen_hash_c,
  built_by and sealed_at move. `check_seal_currency.py --stale-specs`
  then names only html, xml and terminal, master's ledgered debt.
- check_seal_currency: exit 0; check_seal_coverage: OK (1640 seals, 1519
  hold, 121 known-broken, as on the baseline); `tri seals twins`:
  1635 / 548 / 31 disagree, the same as master 14e1c7b;
  core_selfhost: 1/1 ok.

Closes #7307
Closes #7308

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gHashTag
gHashTag disabled auto-merge October 8, 2026 17:18
@gHashTag
gHashTag changed the base branch from master to shep-tmp-base-7331 October 8, 2026 17:18
@gHashTag
gHashTag changed the base branch from shep-tmp-base-7331 to master October 8, 2026 17:18
@gHashTag gHashTag added ci and removed ci labels Oct 8, 2026
@gHashTag

gHashTag commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

Merge shepherd: master moved again, and I re-merged master 14e1c7b in from master's side (8ce59a7, a fast-forward). Only .trinity/seals/t27b_T27bLibm.json conflicted, because master resealed specs/tri/t27b/libm.t27. I regenerated it with t27c seal --save, using t27c built from the merged tree on the t27c lab (18/18 tests pass). Only gen_hash_c, built_by and sealed_at move. FROZEN_HASH is unchanged: master still has not touched compiler.rs. Results on the merged tree: check_seal_currency.py --stale-specs names only html, xml and terminal (master's ledgered debt); check_seal_currency exits 0; check_seal_coverage is OK (1640 seals, 1519 hold, 121 known-broken); tri seals twins gives 1635 / 548 / 31 disagree, the same as master 14e1c7b; core_selfhost passes 1/1. The budget is unchanged: compiler.rs +39 and core_selfhost.rs +15. Auto-merge was off during the base flip (#7489), and the base was checked to be master before auto-merge was turned back on.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-08 17:32:11 UTC

Summary

Status Count
Total Open PRs 50
PRs with Failing Checks 40
PRs with All Checks Green 10
READY 1
FAILING 40
PENDING 0
NO CHECKS YET 0

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

Seal Status

  • ⚠️ STALE -- sha256(compiler.rs)=21a1173dfe32 != 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 ce605a6 into master Oct 8, 2026
41 of 45 checks passed
gHashTag pushed a commit that referenced this pull request Oct 8, 2026
#7331 landed, so this branch's fixtures have the gen-c `for` / `switch`
lowering they need. Only specs/compiler/core/t27core_ddc.t27 conflicted:
both sides repinned its data (master for #7409's buffer sizes, this
branch for the new core). The data is derived, so it was regenerated:
the merged t27core.t27 is byte-identical to this branch's (S, 77284
bytes, sha256 f2611faf...), and `t27c gen-c` of it with t27c built from
this tree on the t27c lab is byte-identical to the pinned E (73153 bytes,
sha256 79967671...). Repacking S and E in the layout the spec states
gives this branch's file byte for byte.

On the merged tree: t27core.t27 test-report 21/21, t27core_ddc.t27 1/1,
core_selfhost 1/1 ok.

Closes #7429

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Oct 8, 2026
master's #7331 changed gen-c and re-sealed with t27c 0.5.1; the three seals this PR touches are re-saved with t27c
built from this merge, and verify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag pushed a commit that referenced this pull request Oct 8, 2026
#7331 landed and changed bootstrap/src/compiler.rs; compiler.rs merged
cleanly (both sides' gen-c changes kept), and the derived files that
conflicted are regenerated, not merged by hand:

- bootstrap/stage0/FROZEN_HASH: the sha256 of the merged compiler.rs,
  3c0ade9e73e425d5...
- The three similarity_search seals (SimilaritySearch,
  VSASimilaritySearch, vsa_VSASimilaritySearch): resealed with
  `t27c seal --save`, t27c built from this tree on the t27c lab, zig 0.16
  on PATH (8/8 tests pass). `check_seal_currency.py --stale-specs` then
  names only html, xml and terminal, master's ledgered debt.
- check_seal_currency: exit 0; check_seal_coverage: OK (1641 seals, 1520
  hold, 121 known-broken, as on the baseline); `tri seals twins`:
  1636 / 548 / 31 disagree, the same as master eda79f0;
  backend_behaviour 24/24 (c_declares_a_local_nested_array_as_a_matrix
  ok), core_selfhost 1/1. gen-c of t27core.t27 is unchanged (the DDC
  pins of master and of #7436 both still hold).

Closes #7441

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag added a commit that referenced this pull request Oct 8, 2026
…gen-c (Closes #7429) (#7436)

* t27b: a constant array repeat has no 65536 cap; t27core buffers 262144 (Closes #7376)

Part of #5980. The self-hosted core's buffers were held at 65536 because
t27b wrote a module var's repeat initializer (`[_]T{v} ** n`) out as an
n-element literal and refused one over 65536 elements. gen-c (`{0}`) and
Zig (`** n`) have no such limit.

const_fill now evaluates the repeated elements once and copies those
bytes over the rest of the array, so module vars and byte-filled
constants of any size need no expanded node list. The cap stays only
for const_agg (constants holding strings), which keeps one value per
element. The locals path (init_repeat, a runtime copy) is unchanged.

specs/tri/t27b/conformance/big_repeat_global.t27: module vars of 262144,
300000 and 200000 elements and a 100000-byte constant. t27c test-report
5/5; t27b interpreter 5/5; t27b on master refuses all four repeats.

t27core: SRC_MAX, OUT_MAX, TOK_MAX and NODE_MAX are 262144; DDC
companion repinned (S 65343, E 62441). Lab: core_selfhost fixpoint ok,
16 core tests, 61-file corpus no mismatch, every refusal its code; DDC
passes under the Zig reference and the t27b interpreter (21.5 MB of
globals); cargo test -p t27b all pass.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* t27core: for over one range and switch as a value, byte-identical to gen-c (Closes #7429)

Part of #5980. Depends on #7331 (gen-c lowers for and switch) and #7409.

- for (a..b) |i| { } becomes `for (size_t i = a; i < b; i++) {`; `|_|`
  names the counter __t27_i. The end may call nothing, and the body may not
  assign a name it reads, nor call anything when it reads a module var: C
  reads the end on every pass, Zig once. Two ranges and for-each (#7420),
  and `..=`, are refused.
- switch becomes a chain of ternaries. Taken only as the whole value of a
  return, a local initializer or an assignment, or as an arm value; the
  subject calls nothing; labels are numbers without `_`, optionally negated;
  `else` once and last. The shapes gen-c loses (#7419) are refused.
- Five new core tests, two accept fixtures that run under C, seventeen
  refusals. Fixpoint holds; t27core_ddc.t27 repinned (S 77284, E 73153).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claude <claude@anthropic.com>
gHashTag added a commit that referenced this pull request Oct 8, 2026
… of compiler_rt (Closes #7819) (#7863)

* t27b: @floor, @ceil, @round, @trunc and @Rem of an f32 call t27 ports of compiler_rt (Closes #7819)

libm.t27 ports compiler_rt's floorf, ceilf, roundf, truncf and fmodf on the bits; libm_plan.t27 plans the five,
and @Rem's second operand takes the first one's type. The conformance spec holds each port to Zig's builtin bit
for bit. Part of #7746.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* t27b: re-seal the libm specs with master's t27c 0.5.1 (Closes #7819)

master's #7331 changed gen-c and re-sealed with t27c 0.5.1; the three seals this PR touches are re-saved with t27c
built from this merge, and verify.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude <claude@anthropic.com>
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

ci owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

self-host: gen-c lowers a switch with no else arm to 0 for the missing case self-host: gen-c declares a range-for counter as int, not size_t

2 participants