wcc/ww: return of a module-global struct ident copies the global's bytes

Returning a global struct by name emitted nothing into the return
scratch (ww) — copy from the g(SB) base. Both-wrong pair: cstage
zeroes the retscr instead (filed task #42); rows pin ww-runtime-correct
with the documented cstage residual. Review item #41.
This commit is contained in:
2026-06-12 09:13:26 +09:00
parent b3a355744f
commit 4b8c8fd9ed
5 changed files with 200 additions and 0 deletions

View File

@@ -260,6 +260,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_globtagisas_run \
$(BIN)/test_dotbasehijack_run \
$(BIN)/test_globtagreassign_run \
$(BIN)/test_globstructret_run \
$(BIN)/test_arr_ptr_global \
$(BIN)/test_def_arr_infer_len \
$(BIN)/test_def_arr_len \
@@ -770,6 +771,16 @@ $(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 $@ $<
$(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 $@ $<