Skip to content

fix(gen-c): a local nested array is declared as a C matrix (Closes #7441) - #7495

Open
gHashTag wants to merge 4 commits into
masterfrom
genc-local-nested-array
Open

gHashTag wants to merge 4 commits into
masterfrom
genc-local-nested-array

Conversation

@gHashTag

@gHashTag gHashTag commented Oct 7, 2026

Copy link
Copy Markdown
Owner

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]u8 became [16]u8 m[16], which no C compiler accepts. specs/depin/prove.t27 and specs/vsa/similarity_search.t27 hit 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_matrix in bootstrap/tests/backend_behaviour.rs compiles three functions with cc and runs them: a [16][16]u8, a [2][K][4]i64 with a named constant dimension, and an initialized [2][2]u8. It expects 4 8 32.

Run on the lab both ways:

  • old compiler (master t27c): the C does not compile, so the test fails;
  • new compiler: passes.

Reseals

Only gen_hash_c moves:

  • .trinity/seals/prove.json and depin_depin.prove.json: 1fe0bdf2 -> 832862c5
  • .trinity/seals/SimilaritySearch.json, VSASimilaritySearch.json and vsa_VSASimilaritySearch.json: fa36bdca -> 9b62b16e

Lab 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

gHashTag and others added 3 commits October 7, 2026 17:02
)

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
@gHashTag gHashTag added the owner-approved-foreign Owner-approved exception to the only-t27 rule: hand-written foreign code allowed in this PR label Oct 7, 2026
@gHashTag
gHashTag enabled auto-merge (squash) October 7, 2026 11:43
@gHashTag

gHashTag commented Oct 7, 2026

Copy link
Copy Markdown
Owner Author

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 (ml_transformer_multi_head_attention: Rust=true, Lean theorem=false), is also red on master b94f486: https://t27c-lab-production.up.railway.app/runs/b94f48659d29bbdbfad76669c5277283a8c11672.json

This was referenced Oct 7, 2026
@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

PR Dashboard

Generated at: 2026-10-07 12:51:15 UTC

Summary

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

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

Seal Status

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

This was referenced Oct 7, 2026

This branch has not been deployed

No deployments
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.

t27c gen-c: local nested array declared as [16]u8 m[16]

1 participant