Files
ww/test/wcc/data/r595_indirect_call_str_arg/case.ww
Hojun-Cho c421c2b20a cgen: key the str/slice arg recognizers off the checker stamp
The wwstage nodeisstr/nodeisslice recognizers were name-keyed for
every non-local shape: an indirect fn-pointer callee ((*f)() — the
errnotest #59.5 divergence, streq receiving a shifted register file)
and module-global let/const idents (path.sepstr — union-widen pushes
zero-filled len/cap) both fell to false while cstage keys off the
checker stamp unconditionally. Both recognizers now fall back to the
stamped n.type_; push and pop sites share them, so the drain stays
balanced by construction. Graduates the #59.5 errnotest pin.
2026-08-08 00:58:04 +09:00

23 lines
556 B
Plaintext

//ww:run
// #59.5: a str returned by an INDIRECT fn-pointer call, passed
// directly as a call arg. The pre-fix wwstage nodeisstr/nodeisslice
// N_CALL arms were callee-name-keyed and fell to false for the
// N_UN(STAR) callee, so only the ptr word was pushed and the callee
// read a shifted register file (len=b.ptr).
package main;
fn hello() str = {
return "hello";
};
fn taker(s: str) i32 = {
if (s.len != 5) { return 1; };
if (s[0] != 104u8) { return 2; };
return 0;
};
fn main() i32 = {
let f = (&hello): *fn() str;
return taker((*f)());
};