wcc/ww: &fn synthesis prefers the current module's fn

The address-of-fn synthesis used a bare lookup — import order could
bind a same-leaf fn from another module, silently LEAQ-ing the wrong
function into a fn-ptr slot. Prefer the current module (mirror
check.c:410/1305). Report item #4 (loud and silent faces pinned).
This commit is contained in:
2026-06-13 03:01:31 +09:00
parent 63e837e820
commit 51e3b8f134
5 changed files with 219 additions and 6 deletions

View File

@@ -260,6 +260,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_defdim_field_run \
$(BIN)/test_defdim_argslice_run \
$(BIN)/test_slttypepref_run \
$(BIN)/test_ampfncollide_run \
$(BIN)/test_gunsigned_run \
$(BIN)/test_taggedidx_run \
$(BIN)/test_fnptrcollide_run \
@@ -792,6 +793,17 @@ $(BIN)/test_slttypepref_run: test/wcc/989_slttypepref_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_ampfncollide_run (#4, c2): `&fn` synthesis (unoptype TK_AMP +
# assignableaddrfn) prefers the current module's fn when a same-leaf fn is
# declared in a later module. Builds/rejects on BOTH driver twins (rule-10).
# See the test header.
$(BIN)/test_ampfncollide_run: test/wcc/989_ampfncollide_run.c \
$(BIN)/ww $(BIN)/ww_ww \
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_gunsigned_run (F7-c5, #25): a module-global unsigned ident on the
# divide/shift/relational path must pick the unsigned opcode. Builds+runs on
# BOTH driver twins (rule-10). CLASS-M — see the test header.