Repository navigation
fix(gen-c): a local nested array is declared as a C matrix (Closes #7441) - #7495
Conversation
) A local `[16][16]u8` kept its inner `[16]` in the element type and reached C as `[16]u8 m[16]`. Every inner fixed dimension now moves to the declarator, `uint8_t m[16][16]`, as a module-level array and a struct field already do. A slice or sentinel dimension stops the peel. The test in backend_behaviour.rs compiles and runs a 2-D, a 3-D with a named size, and an initialized local. Part of #5980. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l matrix declarator Only gen_hash_c moves: the local declarators become `T m[A][B]`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rray # Conflicts: # bootstrap/stage0/FROZEN_HASH # bootstrap/tests/backend_behaviour.rs
|
Lab run on the merged head dad468e: https://t27c-lab-production.up.railway.app/runs/dad468e0574f23b35cc39537dca5bf7b51cd7a14.json. frozen-hash, build, suite (RATCHET CLEAN), seal-currency, seal-coverage (1489 seals, 6 stale, the same as master), specs-generate and misread are green. The one red, the lean gate ( |
#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>
|
Merge shepherd: #7331 landed, and this PR then conflicted, so I merged master eda79f0 in from master's side (9360cc3, a fast-forward). |
PR DashboardGenerated at: 2026-10-08 18:34:18 UTC
Summary
Seal Status
|
…loses #7929) (#7931) Part of #5980 (P1: `**` with a real meaning, numeric literal forms). The self-hosted core accepts a local `var` array as gen-c lowers it, a module array without `static`: a repeat (a GNU range, `{0}` for zero), a list, or a row list (a C matrix, #7495), in a function or a test. It refuses what gen-c lowers with loss: - E_NAME: a local array named like a module name, a parameter or another local of its function (C's shadowing array, which Zig refuses); - E_ARRAY: a local array read outside its block, a dimension or count that is not a number or a number-valued const (an initialized C VLA), and a repeat count that differs from the dimension, module arrays included (C zeros where Zig refuses the type). #7318 is fixed, so the `_` separators in a dimension and in a negated literal const are dropped as gen-c drops them; the three refusals move to accept/separator_dimensions.t27. Numeric `a ** b` stays refused (E_SYNTAX), now pinned by two fixtures on #7427. t27core_ddc.t27 restates the new module vars and is repinned: S 84235, E 78795 bytes. Co-authored-by: Claude <claude@anthropic.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Closes #7441
Part of #5980
What was wrong
gen-c declared a local nested fixed array with a t27 type left inside the C text:
var m: [16][16]u8became[16]u8 m[16], which no C compiler accepts.specs/depin/prove.t27andspecs/vsa/similarity_search.t27hit it, and the self-host needs it.The fix
bootstrap/src/compiler.rs(+24/-2): every inner fixed dimension moves from the element type to the declarator, the same way a struct field (c_array_field) and a module-level array are already declared:uint8_t m[16][16]. A slice, sentinel or inferred inner dimension stops the peel and keeps the old path.Regression test
c_declares_a_local_nested_array_as_a_matrixinbootstrap/tests/backend_behaviour.rscompiles three functions with cc and runs them: a[16][16]u8, a[2][K][4]i64with a named constant dimension, and an initialized[2][2]u8. It expects4 8 32.Run on the lab both ways:
Reseals
Only
gen_hash_cmoves:.trinity/seals/prove.jsonanddepin_depin.prove.json: 1fe0bdf2 -> 832862c5.trinity/seals/SimilaritySearch.json,VSASimilaritySearch.jsonandvsa_VSASimilaritySearch.json: fa36bdca -> 9b62b16eLab runs
Foreign-line budget (#7371)
Master's
check_budget()passes on this diff: compiler.rs +24/-2, backend_behaviour.rs +16. FROZEN_HASH and the seals do not count.🤖 Generated with Claude Code