w6c+w6c_ww: tagged widen-store struct-literal slice field keeps the 3-word header

The cg_widen_tagged_store / cgwidentaggedstorebp struct-payload arm
gated the 3-word {ptr,len,cap} field store on TY_STR only; a slice-
typed field inside a union-payload struct literal fell to the scalar
tail and silently dropped .len/.cap (the #24 gap's widener twin, both
stages symmetric so byte-id gates were blind). Surfaced by #38's
regex-shaped consumer: wide{xs: []u8, ys: []u8, n} widened into
(wide | error | nomem).
This commit is contained in:
2026-06-04 03:42:15 +09:00
parent 91d42d28ab
commit 5f15eb3d09
4 changed files with 37 additions and 15 deletions

View File

@@ -18899,10 +18899,15 @@ fn cgwidentaggedstorebp(c: *cgen, dst: *tinfo, src: *node, slot_off: i32, slot_s
emitline("\tX0, ");
emitoff((slot_off + 8 + fi.foff): i64);
emitline("(BP)\n");
} else { if (isstrtype(c, fi.tnode)) {
// str IS []u8: 3-word field
// (ptr,len,cap) from cgexpr's
// AX/BX/CX (#1/Phase 3).
} else { if (isstrtype(c, fi.tnode)
|| isslicetype(c, fi.tnode)) {
// str IS []u8 and a slice is the
// same 3-word {ptr,len,cap} header
// from cgexpr's AX/BX/CX (#1/Phase
// 3). Slice arm rides #38's regex-
// shaped consumer — the prior str-
// only gate dropped .len/.cap (#24
// gap's widener twin).
emitline("\tMOVQ\tAX, ");
emitoff((slot_off + 8 + fi.foff): i64);
emitline("(BP)\n");