w6c+wwstage: qualify N_DOT-base + addr-of value-global by dotted module (#229)

The cross-module dotted value-global read (`aa.v`) and addr-of (`&aa.v`)
still mangled their symbol via the non-preferring leaf lookup (cstage
masym / wwstage emitsymname), so they emitted `LEAQ main.v(SB)` — the
WRONG module's same-leaf global — returning 99 instead of 7. #1 fixed the
DATA def-site and the bare-ident load; these four dotted LOAD/addr sites
were the residual.

Thread the dotted module name (the `m` in `m.x`) — n->lhs->str /
opnd->lhs->str / lhs.str / basenm — into the existing value mangle
(cstage mahint, wwstage emitsymnamehint), the same polarity the TY_FN
branch beside each site already uses via mafn/emitfnname. The addr-of
spine-walk for a bare-root `&global.field` is a different shape and is
left untouched.

Byte-id-blind (the bootstrap has no colliding leaves), so a committed
runtime + cs==ww test (796) is the net.
This commit is contained in:
2026-06-01 09:57:45 +09:00
parent 07fed80fab
commit 80e7ab7cf3
6 changed files with 238 additions and 12 deletions

View File

@@ -342,6 +342,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_spread_variant_match \
$(BIN)/test_xmod_ident_prefer \
$(BIN)/test_xmod_valglobal_run \
$(BIN)/test_xmod_valglobal_dot_run \
$(BIN)/test_widen_pad_zero_run \
$(BIN)/test_named_ptr_alias_variant_widen \
$(BIN)/test_single_field_struct_zeroinit \
@@ -822,6 +823,14 @@ $(BIN)/test_xmod_valglobal_run: test/wcc/795_xmod_valglobal_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# #229 (N_DOT-base + addr-of sibling of #1): cross-module DOTTED value-
# global read AND &-address-of must mangle by the dotted module name, not
# cur_mod — runtime + cs==ww byte-id. Self-contained multi-package probe.
$(BIN)/test_xmod_valglobal_dot_run: test/wcc/796_xmod_valglobal_dot_run.c \
$(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6l \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# #15: widening a bare *vtable into a NAMED-alias variant (`stream` =
# *vtable) of `(file | stream)` must compute the right tag, not default
# to tag 0. Both-stage byte-id + runtime, plus a degenerate-ambiguity