selfhost+test: route callee_variadic_param N_DOT via fnparamslookupmod (#16)
Latent silent miscompile surfaced by worker-strcontains3 attempting strings.contains tagged-variadic graduation: wwstage cgcall's callee_variadic_param helper (cgenutil.ww:60-70) consumed the N_DOT callee's leaf via callee.str but routed bare fnparamslookup — bypassed the module hint at callee.lhs.str. When two modules export same-leaf fns with differing variadic shapes (e.g. strings.contains(str|rune)... + bytes.contains scalar (u8|[]u8)), the bare walk returned the wrong fn's params for arg-prep while the CALL targeted the correct module-qualified symbol — ABI mismatch. Direct sister of #34 (049ebc1) which graduated fnret's N_DOT arm through fnretlookupmod. #4d's commit body (862715d) explicitly deferred callee_variadic_param's *mod re-routing pending "future stdlib port introducing a tagged-vs-scalar or variadic-vs-non-variadic same-leaf N_DOT collision shape." This is that surfacing. cgenutil.ww: split callee_variadic_param on callee.kind. N_IDENT stays on bare fnparamslookup (same-module-first post-#4d). N_DOT routes through fnparamslookupmod(c, callee.str, callee.lhs.str), pattern- identical to cgcall's N_DOT branch at cgenexpr.ww:2922-2935. Cstage cmd/w6c/cgen.c:4279-4302 reads callee params via typed AST (n->lhs->type + cu->params) — module-aware natively, no sister change needed (mirrors #4d/#28/#31/#34 cstage no-sister notes). 752_modparam_callee: table-driven 3 rows x 2 stages = 6 fixtures. cross_module_same_leaf_variadic_vs_scalar (the wedge), same_module_same_leaf (no-regress), bare_leaf_no_collision (control). #17 filed for the wider convenience-wrapper audit (enumerate all wwstage cgen* helpers that take *node and do bare-leaf lookups; sweep for N_DOT-arm omissions). This commit is narrow to callee_variadic_param. make test 126/126; ww2==ww3==ww4 byte-id holds via 995_self_rebuild.
This commit is contained in:
7
Makefile
7
Makefile
@@ -286,6 +286,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_sumtype_forward \
|
||||
$(BIN)/test_mklabel_modscoped \
|
||||
$(BIN)/test_vararg_seq_percall \
|
||||
$(BIN)/test_modparam_callee \
|
||||
$(BIN)/test_param_shadow_mod \
|
||||
$(BIN)/test_localoff_scope \
|
||||
$(BIN)/test_cast_enum_movl \
|
||||
@@ -727,6 +728,12 @@ $(BIN)/test_vararg_seq_percall: test/wcc/751_vararg_seq_percall.c \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_modparam_callee: test/wcc/752_modparam_callee.c \
|
||||
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_match_4arm_cross_module_run: test/wcc/929_match_4arm_cross_module_run.c \
|
||||
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
|
||||
|
||||
Reference in New Issue
Block a user