wcc: nodeisunsigned N_CALL reads stamped type_ (#168)
Twin of #134 (N_INDEX arm): the wwstage signedness classifier did not consult the checker-stamped type_ for an N_CALL result, so an unsigned-returning call got signed IDIVQ/SARQ instead of DIVQ/SHRQ. cstage was already correct (reads the stamped operand type; check.c:1433), so this is a wwstage-only arm — symmetric outcome both stages. Gate-blind (the bootstrap lacks the shape) — covered by table-driven runtime probe 906, which also asserts w6c==w6c_ww .s byte-identity.
This commit is contained in:
@@ -14898,6 +14898,16 @@ fn nodeisunsigned(c: *cgen, n: *node) bool = {
|
||||
if (k == nkind.N_INDEX) {
|
||||
return typeisunsigned(n.type_: *tinfo);
|
||||
};
|
||||
// nkind.N_CALL: a call returning an unsigned type (e.g. `fn f() u64`)
|
||||
// is unsigned. Read the checker-stamped result type directly — the
|
||||
// N_CALL twin of the #134 N_INDEX arm above. cstage reads the same
|
||||
// stamp via `type_isunsigned(n->lhs->type)`, stamped at check.c N_CALL
|
||||
// `n->type = u->ret`; without this arm the wwstage fell through to
|
||||
// `return false`, picking signed IDIV/SAR over unsigned DIV/SHR on a
|
||||
// call-result div/mod/shift operand. #168.
|
||||
if (k == nkind.N_CALL) {
|
||||
return typeisunsigned(n.type_: *tinfo);
|
||||
};
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -1071,6 +1071,16 @@ fn nodeisunsigned(c: *cgen, n: *node) bool = {
|
||||
if (k == nkind.N_INDEX) {
|
||||
return typeisunsigned(n.type_: *tinfo);
|
||||
};
|
||||
// nkind.N_CALL: a call returning an unsigned type (e.g. `fn f() u64`)
|
||||
// is unsigned. Read the checker-stamped result type directly — the
|
||||
// N_CALL twin of the #134 N_INDEX arm above. cstage reads the same
|
||||
// stamp via `type_isunsigned(n->lhs->type)`, stamped at check.c N_CALL
|
||||
// `n->type = u->ret`; without this arm the wwstage fell through to
|
||||
// `return false`, picking signed IDIV/SAR over unsigned DIV/SHR on a
|
||||
// call-result div/mod/shift operand. #168.
|
||||
if (k == nkind.N_CALL) {
|
||||
return typeisunsigned(n.type_: *tinfo);
|
||||
};
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
@@ -14898,6 +14898,16 @@ fn nodeisunsigned(c: *cgen, n: *node) bool = {
|
||||
if (k == nkind.N_INDEX) {
|
||||
return typeisunsigned(n.type_: *tinfo);
|
||||
};
|
||||
// nkind.N_CALL: a call returning an unsigned type (e.g. `fn f() u64`)
|
||||
// is unsigned. Read the checker-stamped result type directly — the
|
||||
// N_CALL twin of the #134 N_INDEX arm above. cstage reads the same
|
||||
// stamp via `type_isunsigned(n->lhs->type)`, stamped at check.c N_CALL
|
||||
// `n->type = u->ret`; without this arm the wwstage fell through to
|
||||
// `return false`, picking signed IDIV/SAR over unsigned DIV/SHR on a
|
||||
// call-result div/mod/shift operand. #168.
|
||||
if (k == nkind.N_CALL) {
|
||||
return typeisunsigned(n.type_: *tinfo);
|
||||
};
|
||||
return false;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user