wcc,ww: bare-module fn mangles bare, not an imported same-leaf (M4 E2, #84)
A package-less primary's bare fn (module="") whose leaf collided with an imported module's same-leaf exported fn was mis-mangled to the imported qualified name (a user `fn run` emitted as `test.run`), producing a dead-duplicate symbol the linker silently shadowed -- a #263-class silent miscompile, gate-blind and symmetric across both stages. cgen now registers bare-module fns and resolves a bare-ident reference to its own bare leaf: mod_lookup_for_fn prefers the bare entry when the call carries no module hint and skips bare entries when it does, so the moduled-caller path stays byte-identical. The moduled `main` entry carve-out is an orthogonal rule (the linker entry is force-bared) and is retained. Prereq for the @test user-`run` coexist (#80). The bare non-fn (let/def/type) sibling is the same class but hint-less; deferred as #85, noted at the retained skip.
This commit is contained in:
11
Makefile
11
Makefile
@@ -560,6 +560,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_lib_byteid \
|
||||
$(BIN)/test_m2wwi_run \
|
||||
$(BIN)/test_m3sep_run \
|
||||
$(BIN)/test_barefn_collide_run \
|
||||
$(BIN)/test_sepbuild_run \
|
||||
$(BIN)/test_sepdotpath_run \
|
||||
$(BIN)/test_seproot_export_run \
|
||||
@@ -3133,6 +3134,16 @@ $(BIN)/test_sepbuild_run: test/wcc/989_sepbuild_run.c $(BIN)/ww $(BIN)/ww_ww \
|
||||
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# 989_barefn_collide_run — #84 cgen bare-module fn-leaf collision gate. A
|
||||
# package-less root's bare `fn run` must stay BARE (distinct from an
|
||||
# imported `aa.run`), not mis-mangle onto the import (a #263-class silent
|
||||
# dead-dup). Drives BOTH driver stages on a real dir-package import, so it
|
||||
# needs both driver + both compiler + both linker stages + libwwrt.
|
||||
$(BIN)/test_barefn_collide_run: test/wcc/989_barefn_collide_run.c $(BIN)/ww $(BIN)/ww_ww \
|
||||
$(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6a_ww \
|
||||
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
# 989_sepdotpath_run — sep-build of a DOTTED-path (multi-component) package
|
||||
# (#57): the producer must tag a primary body by its full dotted import path
|
||||
# (`//ww:module-reset a.b`), not the leaf `package` clause, so definer ==
|
||||
|
||||
Reference in New Issue
Block a user