wcc/ww: widen of a module-global struct ident copies the full payload

Widening a global struct into a tagged slot copied word0 only; copy
the full payload from g(SB). Both-wrong pair: cstage zero-fills the
payload (filed task #43); rows pin ww-runtime-correct with the
documented cstage residual. Review item #50.
This commit is contained in:
2026-06-12 09:16:52 +09:00
parent 4b8c8fd9ed
commit 32848194d7
5 changed files with 339 additions and 0 deletions

View File

@@ -261,6 +261,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_dotbasehijack_run \
$(BIN)/test_globtagreassign_run \
$(BIN)/test_globstructret_run \
$(BIN)/test_globstructwiden_run \
$(BIN)/test_arr_ptr_global \
$(BIN)/test_def_arr_infer_len \
$(BIN)/test_def_arr_len \
@@ -781,6 +782,16 @@ $(BIN)/test_globstructret_run: test/wcc/989_globstructret_run.c \
$(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).
$(BIN)/test_globstructwiden_run: test/wcc/989_globstructwiden_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 $@ $<
$(BIN)/test_let_global: test/wcc/630_let_global.c $(BIN)/ww $(BIN)/w6c \
$(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<