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:
@@ -5937,11 +5937,18 @@ fn cgstructlitfill(c: *cgen, si: *structinfo, lit: *syntax.node,
|
||||
};
|
||||
if (repeat) {
|
||||
let total: i32 = idx;
|
||||
if (fi.tnode.rhs != nil) {
|
||||
// rule 13: dim off the STAMPED array tinfo, not
|
||||
// the surface node — an N_INTLIT-only read left a
|
||||
// def-dimensioned [N]T field under-filled (ww-only
|
||||
// silent; cstage + the tn twin read stamped alen).
|
||||
let ftfill: *syntax.tinfo = tichase(fi.tnode.type_: *syntax.tinfo);
|
||||
if (ftfill != nil && ftfill.kind == syntax.tykind.TY_ARRAY) {
|
||||
total = ftfill.alen: i32;
|
||||
} else { if (fi.tnode.rhs != nil) {
|
||||
if (fi.tnode.rhs.kind == syntax.nkind.N_INTLIT) {
|
||||
total = fi.tnode.rhs.uval: i32;
|
||||
};
|
||||
};
|
||||
}; };
|
||||
for (idx < total) {
|
||||
if (mode == 1) {
|
||||
emitline("\tMOVQ\t");
|
||||
|
||||
Reference in New Issue
Block a user