From 761cfa4524d0a1f1791592618a30b09c9da79519 Mon Sep 17 00:00:00 2001 From: Hojun-Cho Date: Sat, 6 Jun 2026 21:13:32 +0900 Subject: [PATCH] wcc/cgen: #117 pin scalar-tuple-slice row (broad-arm in-suite net) rob A-corrected: the broad TY_TUPLE arm stays; pin an accepted non-(str,*fn) scalar-tuple slice in-suite. const [](i64,str) with TYPED 1i64 (untyped int is ww-checker-rejected, #120); scalar-first so the i64 reads back via the word0-correct whole-element cursor (#121: .1/word3 truncated). Distinct values + len(t) + cs==ww byte-id lock the scalar-in-slice-backing path. Base f8be2ae has no TY_TUPLE arm -> louds. Test-only; 17/17 ok. --- test/wcc/946_const_slice_aggregate_run.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/wcc/946_const_slice_aggregate_run.c b/test/wcc/946_const_slice_aggregate_run.c index 84d6945e..039026d4 100644 --- a/test/wcc/946_const_slice_aggregate_run.c +++ b/test/wcc/946_const_slice_aggregate_run.c @@ -129,6 +129,27 @@ static const struct row rows[] = { " if (len(tbl) != 3) { return 1; };\n" " return 0;\n" "};\n", 0, K_RUN, NULL }, + /* #117 broad-arm pin (rob): the TY_TUPLE arm also backs an ACCEPTED + * non-(str,*fn) scalar-tuple slice — (i64,str) with a TYPED i64 (a bare + * untyped int is ww-checker-rejected, #120). Scalar FIRST so the i64 + * reads back via the word0-correct whole-element cursor (#121 read-path: + * .1/word3 is truncated, same constraint as the fn-first row). DISTINCT + * values catch a wrong per-row stride/offset; len(t) pins the header; the + * str element rides the 32B backing (its DATAR + len pinned by cs==ww + * byte-id). Base f8be2ae has no TY_TUPLE arm → louds (broad arm is new). */ + { "scalar_tuple_slice", + "package main;\n" + "const t: [](i64, str) = [(10i64, \"a\"), (20i64, \"bb\")];\n" + "export fn main() i32 = {\n" + " let e0 = t[0];\n" + " let e1 = t[1];\n" + " let v0 = e0.0;\n" + " let v1 = e1.0;\n" + " if (v0 != 10) { return 1; };\n" + " if (v1 != 20) { return 2; };\n" + " if (len(t) != 2) { return 3; };\n" + " return 0;\n" + "};\n", 0, K_RUN, NULL }, /* #119: scalar &fn module-globals — DISTINCT fns, each called back * through the reloc (pre-#119: no DATA → undefined ref / garbage). */ { "scalar_fnptr",