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:
@@ -242,7 +242,7 @@ fn cgtypetest(c: *cgen, n: *node) void = {
|
||||
let lc: *local = localfindnode(c, lhs.str);
|
||||
if (lc != nil) {
|
||||
scrutoff = lc.off;
|
||||
scrutt = resolvetype(c, lc.tnode);
|
||||
scrutt = resolvetagged(c, lc.tnode);
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -330,7 +330,7 @@ fn cgtypeassert(c: *cgen, n: *node) void = {
|
||||
let lc: *local = localfindnode(c, lhs.str);
|
||||
if (lc != nil) {
|
||||
scrutoff = lc.off;
|
||||
scrutt = resolvetype(c, lc.tnode);
|
||||
scrutt = resolvetagged(c, lc.tnode);
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -744,7 +744,7 @@ fn cgmatch(c: *cgen, n: *node) void = {
|
||||
let lc: *local = localfindnode(c, scrut.str);
|
||||
if (lc != nil) {
|
||||
scrutoff = lc.off;
|
||||
scrutt = resolvetype(c, lc.tnode);
|
||||
scrutt = resolvetagged(c, lc.tnode);
|
||||
};
|
||||
} else {
|
||||
// Non-ident scrutinee (call result, ?, etc.). Spill into a
|
||||
@@ -766,7 +766,7 @@ fn cgmatch(c: *cgen, n: *node) void = {
|
||||
if (callee.kind == nkind.N_DOT) { cnm = callee.str; };
|
||||
if (cnm.len > 0) {
|
||||
let rt: *node = fnretlookup(c, cnm);
|
||||
if (rt != nil) { scrutt = resolvetype(c, rt); };
|
||||
if (rt != nil) { scrutt = resolvetagged(c, rt); };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user