// glob_str_slice_arg_test — a module-GLOBAL str sliced with a DEFAULT high // bound and passed as a call arg (`take(g[1:])`) must load its length word for // the hi, migrated from test/wcc/989_globstrslice_run.c (F8-c2, #47). The // wwstage N_SLICE call-arg pusharg had no global-str (N_TNAME "str") arm for a // default hi, so AX kept the base pointer and got PUSHQ'd as the hi → len = // ptr-lo, garbage; the fix emits the same `LEAQ g(SB),CX; MOVQ 8(CX),AX` len // load as the global-slice arm (str IS []u8, len@+8), aligning UP to cstage. // cs==ww was byte-id-blind; the .len asserts pin the runtime contract; the .ptr // row proves the pointer word survives, the explicit-hi row is the control. package glob_str_slice_arg_test; let g: str = "hello"; fn slen(s: str) i32 = { return len(s): i32; }; fn sfirst(s: str) i32 = { return s[0]: i32; }; @test fn gstr_defhi() void = { assert(slen(g[1:]) == 4); }; @test fn gstr_defhi_full() void = { assert(slen(g[0:]) == 5); }; @test fn gstr_defhi_ptr() void = { // the ptr word is still correct: g[1:][0] == 'e' == 101. assert(sfirst(g[1:]) == 101); }; @test fn gstr_explicit() void = { // explicit hi (hi != nil path) must not regress. assert(slen(g[1:3]) == 2); };