Repository navigation
t27core: nested arrays and list initializers, byte-identical to gen-c (Closes #7361) - #7374
Merged
Merged
Conversation
…Closes #7361) P1 slice 3 of the self-hosted core (Part of #5980). - A 1-D array global takes a list `[_]T{ e, ... }`, and a 2-D global `[N][M]T` takes rows `[_][M]T{ [_]T{ e, ... }, ... }`; the core writes `T a[N][M] = { { e, ... }, ... };` as gen-c does. a[i][j] reads, stores and op= work in functions and tests. - Refused with E_ARRAY, since gen-c lowers them with loss or Zig refuses them: the nested repeat and a repeated row (#7353), a list or row whose item count is not its dimension, a named dimension with a list, a `_` in an inner dimension, a mismatched inner dimension or row type, a row or whole array used as a scalar. Three dimensions stay refused. - `defer` stays refused: gen-c writes it as a comment and the call never runs (#7352). Fixture e2_defer_call. - The core sits at its 64 KiB source buffer (t27b's repeat cap). Node array reads go through accessors and comments are tightened to fit: S is 65341 bytes. - t27core_ddc.t27 repinned to S (65341 bytes) and E (62437 bytes). Checked on the t27c lab: 16 core tests pass, fixpoint holds, the three accept fixtures are byte-identical and run, 29 refusals give their codes, corpus differential 61 files with no mismatch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
enabled auto-merge (squash)
October 7, 2026 08:35
This was referenced Oct 7, 2026
This was referenced Oct 7, 2026
Contributor
Contributor
PR DashboardGenerated at: 2026-10-07 08:51:19 UTC
Summary
Seal Status
|
gHashTag
added a commit
that referenced
this pull request
Oct 7, 2026
…counter (Refs #7307) After the second master merge (#7374, #7360, #7365), these three specs' gen-c differs under this branch's compiler only by `for (int ` -> `for (size_t `, so the Railway t27c lab resealed them (6 files with twins). Lab check on the merge tree f4edb20 vs master fe1c866: - gen-c corpus: 132 of 1538 specs change, all counter-type only; no exit-code change - seal-currency stale list after reseal = master's 13 (all ledgered in tools/seal_baseline.txt) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gHashTag
added a commit
that referenced
this pull request
Oct 8, 2026
…se (Closes #7307, Closes #7308) (#7331) * fix(t27c gen-c): size_t range counter, refuse an integer switch without 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> * seals: reseal the 99 specs whose gen-c moved from `int` to `size_t` counters (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> * seals: reseal the 8 specs the merge left stale under the size_t counter (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> * seals: reseal knowledge_graph, graph_bfs, prims_mst under the size_t counter (Refs #7307) After the second master merge (#7374, #7360, #7365), these three specs' gen-c differs under this branch's compiler only by `for (int ` -> `for (size_t `, so the Railway t27c lab resealed them (6 files with twins). Lab check on the merge tree f4edb20 vs master fe1c866: - gen-c corpus: 132 of 1538 specs change, all counter-type only; no exit-code change - seal-currency stale list after reseal = master's 13 (all ledgered in tools/seal_baseline.txt) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * t27c gen-c: fit #7331 into the foreign-line budget; its tests become t27 data Owner rule #7371 caps hand-written foreign additions at 40 lines per file and 80 per PR. This PR was +64 in compiler.rs and +237 in two new Rust integration tests, so the own-language budget denied it. - compiler.rs: same two fixes, +39. The size_t comments shrink to one line, and the #7308 check builds one label list instead of two. The behaviour is unchanged: an integer switch (number, negative or char label) with no `else` or `_` arm is refused, and enum-literal switches are left alone. - The two Rust test files and their specs/compiler repro specs are gone. The same checks are now .t27 data run by the existing core_selfhost harness: fixtures/core_selfhost/genc/ is built by gen-c and its tests are run (for_counter: counts past INT_MAX; switch_exhaustive: else, `_`, enum switches), and fixtures/core_selfhost/both_refuse/ joins BOTH_REFUSE (the issue repro, negative and char labels). The harness hook is a few lines in core_selfhost.rs. - The foreign-exceptions entries for the deleted tests are removed. Refs #7307, #7308 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fixtures(core_selfhost/genc): build no `_` arm; gen-c writes `(x == _)` for it The runnable switch fixture had a `_ =>` arm. gen-c still lowers that arm to `(x == _)`, which C cannot compile -- the known defect owned by the gen-c defects lane, out of scope here. The old Rust test only checked that gen-c accepts the arm; the corpus spec specs/demos/jones_topology_decision_gate.t27 keeps that covered, since its three numeric switches end in `_ =>` and still generate. Refs #7308 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * seals: reseal the 10 specs the third master merge left stale under the size_t counter (Refs #7307) After merging master (#7535, #7537), these specs' gen-c differs under this branch's compiler only by `for (int ` -> `for (size_t ` (0 other changed lines each), so the Railway t27c lab resealed them (20 files with twins): automation/bot-topic-tabs, base/types, graph/knowledge_graph, math/phi_universal_attractor, runtime/execute, runtime/instance, sync/index, sync/schema, tri/collections/bitvector, vsa/vsa_core. Lab check on the merge tree: - FROZEN_HASH matches the merged compiler.rs; cargo build --release -p t27c passes - check_seal_currency.py: 0 stale gen hashes, 6 ledgered (same as master) - check_seal_coverage.py: OK, 1496 seals, 121 known-broken all ledgered - cargo test --release -p t27c --test core_selfhost: 1 passed (genc and both_refuse fixtures) 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>
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.
Closes #7361
Part of #5980
P1 slice 3 of the self-hosted core: nested arrays and list initializers.
deferstays refused, because gen-c drops the deferred call (#7352).What the core learns
[_]T{ e, ... }with a trailing comma allowed. The elements are any expressions in the subset: names, constants,_-separated and hex numbers, operators.[N][M]Ttakes rows:[_][M]T{ [_]T{ e, ... }, ... }. The core writesT a[N][M] = { { e, ... }, ... };, which is the bytest27c gen-cwrites.a[i][j]reads, stores andop=work in functions and in tests.What the core refuses
e9_nested_repeat,e9_nested_repeated_rowe9_list_too_short,e9_row_count_shorte9_list_too_long,e9_row_too_longe9_named_dimension_liste9_separator_in_inner_dimensiona[1][1_0](#7318)e9_inner_dimension_mismatch,e9_row_type_mismatche9_row_used_as_value,e9_nested_array_as_valuee3_three_dimensionse2_defer_calldeferas a comment, so the call never runs (#7352)Size
The core is at its source buffer. SRC_MAX is 65536, which is t27b's repeat-initializer cap. To fit, node-array reads go through seven one-line accessors (
na(n)fornd_a[n as usize], and so on), two dead text functions are removed, and comments are tightened. S is 65341 bytes. The next slice needs the cap raised, or the buffers split.Other changes
compiler.rschange, so no foreign label is needed.forandswitchare untouched.t27core_ddc.t27is repinned:41a73cd5...;4e6424a4....Decoding its data reproduces both files byte for byte.
Checked on the t27c lab
accept/nested_arrays.t27is byte-identical with gen-c, and its test binary (-std=c99 -DT27_TEST_MAIN) exits 0.cargo test --release -p t27c --test core_selfhostpasses, and so do specs-parse and specs-generate.🤖 Generated with Claude Code