// valstruct_subsize_test — sub-8 nested value-struct zero-init extent, local + // global, distinct byte asserts. Migrated from // test/wcc/949_valstruct_subsize_run.c. A nested {[N]u8} value-struct of ABI // size 1/2/4 once emitted a stray MOVQ $0 (local) / 8 zero DATA bytes (global) // on wwstage that cstage didn't. cstage build+run was T1; cs==ww .s byte-id // rides T2 (test-lang-byteid). // // The D1/D2 rows WRITE then READ a byte so the value is deterministic (the // robust falsifiable dimension). The ctl_*_16 rows are the negative control: a // >8 multi-word value-struct still zero-inits — a wrongly-suppressed >8 zero arm // would read stack garbage (and diverge from the still-zeroing cstage on the T2 // byte-id, which is the real guarantee for the unwritten read). package valstruct_subsize_test; type in4 = struct { m: [4]u8 }; type ov4 = struct { i: in4 }; type in2 = struct { m: [2]u8 }; type ov2 = struct { i: in2 }; type in1 = struct { m: [1]u8 }; type ov1 = struct { i: in1 }; type in16 = struct { m: [16]u8 }; type ov16 = struct { i: in16 }; let G4: ov4; let G2: ov2; let G1: ov1; let G16: ov16; @test fn d1_local_4() void = { let o: ov4; o.i.m[0] = 66u8; assert(o.i.m[0]: i32 == 66); }; @test fn d1_local_2() void = { let o: ov2; o.i.m[1] = 55u8; assert(o.i.m[1]: i32 == 55); }; @test fn d1_local_1() void = { let o: ov1; o.i.m[0] = 44u8; assert(o.i.m[0]: i32 == 44); }; @test fn d2_global_4() void = { G4.i.m[0] = 66u8; assert(G4.i.m[0]: i32 == 66); }; @test fn d2_global_2() void = { G2.i.m[1] = 55u8; assert(G2.i.m[1]: i32 == 55); }; @test fn d2_global_1() void = { G1.i.m[0] = 44u8; assert(G1.i.m[0]: i32 == 44); }; @test fn ctl_local_16() void = { let o: ov16; assert(o.i.m[7]: i32 == 0); }; @test fn ctl_global_16() void = { assert(G16.i.m[7]: i32 == 0); };