fold-2 chunk C2 (drew's Fam8-13 plan): 14 tuple value-row C drivers migrate to 15 test/lang/*_test.ww @test row-tables (the +1 is 954_tuprecv, slimmed not deleted -- its value rows split out while the asserttyped-stamp dimension stays as a carrier-split C pin, mutation-proven non-vacuous). Reject rows move to 32 test/wcc/data/*/case.ww //ww:error carriers (runww asserts the substring in BOTH stages). The test-lang byte-id (LANGBYTEID) gate gives cs==ww automatically and is strictly more sensitive than re-running the wwstage leg; floor 59->74. Tuple surfaced zero cs!=ww as the plan predicted -- no value-only carve. The 945 trio folds in here; 940_global_sret / 940_str_forrange / 926_tagscr untouched (routed to drew per-file). Test count 402->388 = the 14 retired drivers.
51 lines
1.9 KiB
Plaintext
51 lines
1.9 KiB
Plaintext
// overcap_tuple_field_store_test — project #234: storing the result of an
|
|
// over-capacity tuple-returning call (sret: ([]u8,[]u8) = 6 GP) into a struct
|
|
// field or an indexed lvalue. Migrated from
|
|
// test/wcc/940_overcap_tuple_field_store_run.c. A FIELD or INDEXED dest stayed
|
|
// unwired: the store dropped the callee's sret body (a truncated MOVQ through a
|
|
// stale RDI), a SILENT miscompile gate-blind because the bootstrap never
|
|
// field-stores a wide tuple. The fix points the callee's hidden sret dest
|
|
// straight at the destination slot when it is a LOCAL (BP-relative). These
|
|
// @test fns pin the runtime contract (T1, exit 0 both stages); the byte-id
|
|
// gate (T2) keeps cs==ww. Every other dest (via_ptr / global / runtime-index /
|
|
// N_DOT-base index / chained index) HARD-ERRORS LOUD (#234-tail) and lives as a
|
|
// reject carrier (test/wcc/data/overcap_*_be/). cap != len in every wide
|
|
// element so a dropped len OR cap is caught.
|
|
|
|
package overcap_tuple_field_store_test;
|
|
|
|
fn wide() ([]u8, []u8) = {
|
|
let a: []u8; a.len = 1; a.cap = 5;
|
|
let b: []u8; b.len = 2; b.cap = 6;
|
|
return (a, b);
|
|
};
|
|
|
|
type S_struct_field = struct { hdr: int, f: ([]u8, []u8) };
|
|
|
|
// indexed_local — `arr[1] = wide()`, arr: [2]([]u8,[]u8). Readback via
|
|
// `(&arr[1]):*int` p[i] (a tuple-element READ arr[1].N is a separate gap, filed
|
|
// #238) — len0=1, cap0=5, len1=2, cap1=6.
|
|
@test fn indexed_local() void = {
|
|
let arr: [2]([]u8, []u8);
|
|
arr[1] = wide();
|
|
let p: *int = (&arr[1]): *int;
|
|
assert(!(p[1] != 1));
|
|
assert(!(p[2] != 5));
|
|
assert(!(p[4] != 2));
|
|
assert(!(p[5] != 6));
|
|
};
|
|
|
|
// struct_field — `s.f = wide()`, S = struct { hdr:int, f:([]u8,[]u8) }. foff!=0
|
|
// (after hdr) + hdr-uncorrupted check. Pointer readback `(&s.f):*int`.
|
|
@test fn struct_field() void = {
|
|
let s: S_struct_field;
|
|
s.hdr = 99;
|
|
s.f = wide();
|
|
assert(!(s.hdr != 99));
|
|
let p: *int = (&s.f): *int;
|
|
assert(!(p[1] != 1));
|
|
assert(!(p[2] != 5));
|
|
assert(!(p[4] != 2));
|
|
assert(!(p[5] != 6));
|
|
};
|