wcc/ww: return of a module-global struct ident copies the global's bytes
Returning a global struct by name emitted nothing into the return scratch (ww) — copy from the g(SB) base. Both-wrong pair: cstage zeroes the retscr instead (filed task #42); rows pin ww-runtime-correct with the documented cstage residual. Review item #41.
This commit is contained in:
@@ -36329,6 +36329,14 @@ fn cgreturn(c: *cgen, n: *node) void = {
|
||||
let addrsrc: bool = false;
|
||||
if (rhs.kind == nkind.N_IDENT) {
|
||||
okrhs = true;
|
||||
// #41 (#263 ww-runtime-correct): a module-global struct
|
||||
// source has no BP slot — route it through the addrsrc
|
||||
// memcpy (LEAQ g(SB),SI via aggargsrcaddr). Pre-fix the
|
||||
// rl==nil N_IDENT arm below emitted nothing → zeroed
|
||||
// @retscr. cstage copies frame garbage (cstage half #42).
|
||||
if (localfindnode(c, rhs.str) == nil) {
|
||||
addrsrc = true;
|
||||
};
|
||||
};
|
||||
if (rhs.kind == nkind.N_STRUCTLIT) {
|
||||
okrhs = true;
|
||||
|
||||
@@ -1421,6 +1421,14 @@ fn cgreturn(c: *cgen, n: *node) void = {
|
||||
let addrsrc: bool = false;
|
||||
if (rhs.kind == nkind.N_IDENT) {
|
||||
okrhs = true;
|
||||
// #41 (#263 ww-runtime-correct): a module-global struct
|
||||
// source has no BP slot — route it through the addrsrc
|
||||
// memcpy (LEAQ g(SB),SI via aggargsrcaddr). Pre-fix the
|
||||
// rl==nil N_IDENT arm below emitted nothing → zeroed
|
||||
// @retscr. cstage copies frame garbage (cstage half #42).
|
||||
if (localfindnode(c, rhs.str) == nil) {
|
||||
addrsrc = true;
|
||||
};
|
||||
};
|
||||
if (rhs.kind == nkind.N_STRUCTLIT) {
|
||||
okrhs = true;
|
||||
|
||||
@@ -36329,6 +36329,14 @@ fn cgreturn(c: *cgen, n: *node) void = {
|
||||
let addrsrc: bool = false;
|
||||
if (rhs.kind == nkind.N_IDENT) {
|
||||
okrhs = true;
|
||||
// #41 (#263 ww-runtime-correct): a module-global struct
|
||||
// source has no BP slot — route it through the addrsrc
|
||||
// memcpy (LEAQ g(SB),SI via aggargsrcaddr). Pre-fix the
|
||||
// rl==nil N_IDENT arm below emitted nothing → zeroed
|
||||
// @retscr. cstage copies frame garbage (cstage half #42).
|
||||
if (localfindnode(c, rhs.str) == nil) {
|
||||
addrsrc = true;
|
||||
};
|
||||
};
|
||||
if (rhs.kind == nkind.N_STRUCTLIT) {
|
||||
okrhs = true;
|
||||
|
||||
Reference in New Issue
Block a user