wcc: structlit repeat-fill dim off the stamped tinfo (rule 13)
cgstructlitfill's `...` total read only an N_INTLIT dim node, so a def-dimensioned [N]T struct field under-filled: elements 1..N-1 kept the zero-fill, silently, wwstage only (cstage and the tn twin read the stamped array length). Read tichase(fi.tnode.type_).alen first; the surface node stays as the fallback for unstamped shapes.
This commit is contained in:
16
test/wcc/data/defdim_field_fill/case.ww
Normal file
16
test/wcc/data/defdim_field_fill/case.ww
Normal file
@@ -0,0 +1,16 @@
|
||||
//ww:run-exit 0
|
||||
// structlit `...` repeat-fill on a def-dimensioned [N]T field: the
|
||||
// fill total must come off the stamped array tinfo (rule 13). The
|
||||
// N_INTLIT-only surface read left elements 1..N-1 zero (ww-only).
|
||||
package main;
|
||||
def N: int = 4;
|
||||
type holder = struct { arr: [N]i64, tail: i64 };
|
||||
export fn main() i32 = {
|
||||
let h: holder = holder{ arr = [7...], tail = 9 };
|
||||
if (h.arr[0] != 7) { return 1; };
|
||||
if (h.arr[1] != 7) { return 2; };
|
||||
if (h.arr[2] != 7) { return 3; };
|
||||
if (h.arr[3] != 7) { return 4; };
|
||||
if (h.tail != 9) { return 5; };
|
||||
return 0;
|
||||
};
|
||||
Reference in New Issue
Block a user