// globfloatstructarg_test — module-global float-bearing struct passed by value, // migrated from test/wcc/989_globfloatstructarg_run.c (#5-C4, #31, F8 EXCEPTION). // cgcall's per-arg drain decides the SysV eightbyte class via structfloatclass // read from the local slot's tnode ONLY; a module-global struct arg (lc==nil) // kept stfc=0, so the float eightbytes drained as integers (POPQ into DI/SI) and // X0 was never loaded — the callee read its f64 fields from the wrong registers. // cstage classifies off the operand TYPE and ran correct — the cat-A divergence. // The fix keys structfloatclass off the global's declared tnode (align ww UP); // .s is byte-identical. The C driver ran both stages (rule-10 agree+hit); here // T1 cstage run + T2 byte-id. Each row had its own `pair`/`gp`; renamed per-row // for single-file coexistence (the global-vs-local drain class is unchanged). package globfloatstructarg_test; type pair_ff = struct { f: f64, i: i64 }; let gp_ff: pair_ff = pair_ff { f = 1.5, i = 9 }; fn take_ff(p: pair_ff) int = { if (p.f == 1.5 && p.i == 9) { return 0; }; return 2; }; type pair_if = struct { i: i64, f: f64 }; let gp_if: pair_if = pair_if { i = 9, f = 2.5 }; fn take_if(p: pair_if) int = { if (p.i == 9 && p.f == 2.5) { return 0; }; return 2; }; type pair_bb = struct { a: f64, b: f64 }; let gp_bb: pair_bb = pair_bb { a = 1.5, b = 2.5 }; fn take_bb(p: pair_bb) int = { if (p.a == 1.5 && p.b == 2.5) { return 0; }; return 2; }; // float_first: f->X0 (#31). @test fn float_first() void = { assert(take_ff(gp_ff) == 0); }; // int_first: int eb->GP, f->X0. @test fn int_first() void = { assert(take_if(gp_if) == 0); }; // both_float: two SSE eightbytes. @test fn both_float() void = { assert(take_bb(gp_bb) == 0); };