test: migrate global value r/w family-5 to test/lang @test, retire C twins (fold-2)

Continue fold-2: migrate the global-value read/store/addr-of family (non-tagged)
from bespoke build+run C twins to test/lang @test, retiring each twin in the
same commit. Runtime coverage MOVES from $(TESTS) to test-lang (T1 runs+asserts
via `ww test`) + test-lang-byteid (T2 keeps cs==ww .s byte-id); the $(TESTS)
headline drops 3 (421->418). All asserts are primitive int comparisons; fresh
globals are zeroed, so a store that misses the symbol reads back 0 and FAILS.

  989_globptrfield_run.c  -> glob_ptr_field_test.ww  (scalar field store through a module-global *struct pointer loads the pointer from gp(SB), not saved BP; runtime gp=&backing form, static-init is #48-blocked)
  989_globstructret_run.c -> glob_struct_ret_test.ww (returning a module-global struct ident by value copies g's bytes; rsz 16 + rsz 24, each field asserted)
  989_dotbasehijack_run.c -> dotbase_hijack_test.ww  (indexing an [N]T field of a module-global struct addresses the struct field, not an unrelated global sharing the field name; +typed-inner control +colliding-global-intact pin)

glob_ptr_field keeps only the .c's offset-0 row: an added non-zero-offset row
(gp.g=9) surfaced a cs!=ww divergence (cstage folds the offset into the store
displacement `MOVQ AX,8(BX)`; wwstage emits `ADDQ $8,BX; MOVQ AX,(BX)`) — a
latent global-*struct-pointer field-store divergence beyond the .c's coverage,
reported for the backlog, not carried here. Bump LANGBYTEID_EXPECTED_MIN 35->38.
This commit is contained in:
2026-06-22 12:31:23 +09:00
parent b879d38b0f
commit a6b74e46c4
7 changed files with 108 additions and 503 deletions

View File

@@ -289,12 +289,9 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_fnptrcollide_run \
$(BIN)/test_tagnorm_run \
$(BIN)/test_globtagisas_run \
$(BIN)/test_dotbasehijack_run \
$(BIN)/test_globtagreassign_run \
$(BIN)/test_globstructret_run \
$(BIN)/test_globstructwiden_run \
$(BIN)/test_globtagwiden_run \
$(BIN)/test_globptrfield_run \
$(BIN)/test_globfloatstructarg_run \
$(BIN)/test_arr_ptr_global \
$(BIN)/test_def_arr_infer_len \
@@ -1095,16 +1092,6 @@ $(BIN)/test_globtagisas_run: test/wcc/989_globtagisas_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_dotbasehijack_run (F8-c4, #20): indexing an [N]T field of a module-
# global struct must not be hijacked by an unrelated global sharing the
# field's name. Builds+runs on BOTH driver twins (rule-10); align-UP.
$(BIN)/test_dotbasehijack_run: test/wcc/989_dotbasehijack_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_globtagreassign_run (F8-c5, #32, #263): reassigning a module-global
# tagged ident (g = expr) must store tag+payload. ww-runtime-correct; cstage
# drops the store (cs!=ww residual, cstage half = task #41). Per-driver
@@ -1116,16 +1103,6 @@ $(BIN)/test_globtagreassign_run: test/wcc/989_globtagreassign_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_globstructret_run (F8-c6, #41, #263): returning a module-global struct
# ident by value must copy g's bytes. ww-runtime-correct; cstage copies frame
# garbage (cs!=ww residual, cstage half = task #42). Per-driver expected rows.
$(BIN)/test_globstructret_run: test/wcc/989_globstructret_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_globstructwiden_run (F8-c7, #50, #263): widening a module-global struct
# ident into a tagged union must copy the full payload. ww-runtime-correct;
# cstage zero-fills the payload (cs!=ww residual, cstage half = task #43).
@@ -1147,17 +1124,6 @@ $(BIN)/test_globtagwiden_run: test/wcc/989_globtagwiden_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_globptrfield_run (inverse-set #47, report-item [58]): a field store
# through a module-global *struct pointer must load the pointer from g(SB),
# not deref saved BP. cstage SEGV'd (rc=139); align cstage UP to ww (rc=7),
# cs==ww byte-identical. Runtime-assign repro (static-init form is #48-blocked).
$(BIN)/test_globptrfield_run: test/wcc/989_globptrfield_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_globfloatstructarg_run (F8-c9, #31, the EXCEPTION): a module-global
# float-bearing struct passed by value must drain its float eightbytes into
# the SSE arg regs. align-UP — structfloatclass keyed off the global tnode.
@@ -3412,7 +3378,7 @@ test-lang: all
LANGBYTEID_DIR = $(OUT)/langbyteid
LANGBYTEID_FILES = $(wildcard test/lang/*_test.ww)
LANGBYTEID_VERB = test -c
LANGBYTEID_EXPECTED_MIN = 35
LANGBYTEID_EXPECTED_MIN = 38
$(if $(LANGBYTEID_FILES),,$(error test-lang-byteid: empty corpus))
test-lang-byteid: all
@set -e; \