Files
ww/test
Hojun-Cho 098b58d15c test: regression lock for struct-ABI size formula (#78 lock)
Project #78 was ken-flagged: cstage folded size(struct{i32,i32,i32}) to
12 (cmd/wcc/check.c:760, `(off + maxalign - 1) & ~(maxalign - 1)`) while
wwstage walked a slot-padded fsz ladder and yielded 16. The two
checkers ran different layout formulas. d4e500f (#169) closed the
cgen ABI half by introducing structabisize and walking it via per-
field tinfo.align; 39f9267 + 66a91c8 converged the remaining cgen
sites that had picked the slot-padded number. Verified at the size(T)
fold and the .s byte-id on every layout-edge shape.

Add 762_struct_abi_size.c (6 table rows) to lock the closure. Each
row carries a (sz, aln) field table; the expected size is computed in
C via the Hare layout formula (rule 13: no hardcoded size literals —
a formula bump lands in compute_expected and every row tracks). Both
gates run per row: a runtime check that `return size(T): i32` matches
the computed expected on both stages (catches a fold drift), and a
w6c vs w6c_ww .s byte-id (catches a cgen-ABI walker drift even when
the fold still matches — the two walkers are independent SSoTs).

Rows target maxalign edges:

  i32_x3_maxalign4          #78 canonical, natural==ABI==12
  i32_i32_i64_lead_narrow   maxalign 8, narrow lead, ABI 16
  i64_i32_i32_sub8_tail     #169 sub-8 tail, ABI 16 (the round-up)
  i16_x3_maxalign2          maxalign 2, natural==ABI==6
  i32_i32_i64_mid_align     mid-record align step explicit
  i64_x3_natural_24         all 8-wide, natural==ABI==24

GATE POLARITY: this file must stay GREEN. A red here means either
d4e500f reverted, or one of the two layout walkers (check.c:760 /
check.ww:958 / cgen.c struct_arg_size / cgenutil.ww structabisize)
drifted from the formula.
2026-05-28 16:54:08 +09:00
..