cgen: default the hi bound of an N_DOT array-field slice arg

pushargsrev's N_SLICE arm resolved esz and the base address from the
stamped tinfo of an N_DOT [N]T-field base but let the omitted hi bound
fall to $0, so the #258 array-to-slice borrow desugar handed callees a
zero-length slice: base64 clear()'s bytes.zero(e.ibuf) was a runtime
no-op under the wwstage frontend. Take the element count from the
field's array tinfo like the cgslice #252 arm and cstage's bu->alen.
Graduates r989_libprecond_decodedsize_aligned and the 989_lib_byteid
#59.3 base64 pin.
This commit is contained in:
2026-08-07 23:50:02 +09:00
parent 58641e97a5
commit 4559b52950
3 changed files with 13 additions and 3 deletions

View File

@@ -774,9 +774,17 @@ fn pushargsrev(c: *cgen, arg: *syntax.node, param: *syntax.node, memphase: bool,
emitline("\tMOVQ\t8(CX), AX\n");
};};
};
} else { if (dotbu != nil && dotbu.kind == syntax.tykind.TY_ARRAY) {
// #252 twin: default-hi over an N_DOT `[N]T`-field base —
// element count from the field's array tinfo (cstage reads
// bu->alen uniformly). Without this the #258 array→slice
// borrow desugar handed callees a 0-length slice.
emitline("\tMOVQ\t$");
emitint(dotbu.alen: i64);
emitline(", AX\n");
} else {
emitline("\tMOVQ\t$0, AX\n");
};};};
};};};};
emitline("\tPUSHQ\tAX\n");
// lo (default 0) → AX
if (lo != nil) { cgexpr(c, lo); }