selfhost: alias-aware istaggedtype for nested-union match

`type error = !(invalid | overflow)` miscompiled — istaggedtype
only matched N_TTAGGED directly, so an `e: error` param spilled
as 8B scalar and the match's slot+8 read trailed into saved BP.

Mirror isstrtype's alias+bang unwrap; add resolvetagged() for
is/as/match sites that need the inner N_TTAGGED. Frame scan
counts via slotsize so wwstage stays byte-identical to cstage.
Unblocks lib/strconv.strerror.
This commit is contained in:
2026-05-13 04:23:31 +09:00
parent e16634baec
commit 6e7c9e0df4
9 changed files with 893 additions and 59 deletions

View File

@@ -199,7 +199,7 @@ fn cgfnparams(c: *cgen, params: *node) void = {
p = p.next;
continue;
};
if (istaggedtype(p.lhs)) {
if (istaggedtype(c, p.lhs)) {
let slot: i32 = slotsize(c, p.lhs);
let nw: i32 = slot / 8;
if (idx + nw <= 6) {
@@ -317,7 +317,7 @@ fn cgfn(c: *cgen, fn_: *node) void = {
let frame: i32 = 0;
for (scanp != nil) {
if (scanp.kind == nkind.N_PARAM) {
if (istaggedtype(scanp.lhs)) { frame += 24; }
if (istaggedtype(c, scanp.lhs)) { frame += slotsize(c, scanp.lhs); }
else { if (isslicetype(c, scanp.lhs)) { frame += 24; }
else { if (isstrtype(c, scanp.lhs)) { frame += 16; }
else { frame += 8; }; }; };