Files
ww/test/wcc/data/r234_chain_leaf_sret/case.ww
Hojun-Cho 94928470bc w6c: sret-wire the chained-leaf call store (o.a.b = wide())
The chained value-struct walker's N_CALL arm handled only <=24B
register returns; an sret-class rhs fell to the scalar tail and
stored ONE word (the sret dest pointer) into the leaf -- silent
truncation in BOTH stages, byteid-blind. Point the callee's hidden
RDI at the BP-relative leaf slot (the single-dot #234 arm verbatim);
a ptr-root/global chain joins the #234-tail loud-stop family.
2026-08-08 23:51:17 +09:00

30 lines
714 B
Plaintext

//ww:run-exit 0
// #234 chained-leaf arm: `o.a.b = f()` with a >24B sret-class return
// routes the callee's hidden RDI at the leaf slot. Pre-fix both stages
// fell to the scalar tail and stored ONE word (the sret dest pointer).
package main;
type big = struct { x: i64, y: i64, z: i64, w: i64 };
type mid = struct { pad: i64, b: big };
type outer = struct { a: mid };
fn f() big = {
let r: big;
r.x = 11;
r.y = 22;
r.z = 33;
r.w = 44;
return r;
};
export fn main() i32 = {
let o: outer;
o.a.pad = 7;
o.a.b = f();
if (o.a.pad != 7) { return 1; };
if (o.a.b.x != 11) { return 2; };
if (o.a.b.y != 22) { return 3; };
if (o.a.b.z != 33) { return 4; };
if (o.a.b.w != 44) { return 5; };
return 0;
};