wcc/ww: don't interface-check the sep-build root unit (BUG-1, #69)

The --sep producer compiled the ROOT build-target with the .wwi-producer
-I flag, so check_exported_type ran on the root and rejected a real-tool
root's legitimate `export fn f(a: *t)` over an unexported local type t
(the root is terminal — its interface is never imported, and its .wwi is
never consumed). The combined build never passes -I, so it built fine.
For pi==root, invoke w6c with -c -o only, no -I. Both stages (the wwstage
twin builds the shorter root argv). Gates that asserted __root.wwi exists
encoded the buggy behavior; updated to assert __root.s (the consumed
product) while deps' .wwi byte-id is retained.

M3-tail commit-6 prerequisite. Gate 989_seproot_export_run reproduces the
export-fn-over-unexported-type root + proves it sep-builds, with a
non-vacuity leg that the forced -I path still rejects.
This commit is contained in:
2026-06-16 17:16:37 +09:00
parent 747475174a
commit 2ff54c8bd4
7 changed files with 362 additions and 26 deletions

View File

@@ -565,6 +565,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_m3sep_run \
$(BIN)/test_sepbuild_run \
$(BIN)/test_sepdotpath_run \
$(BIN)/test_seproot_export_run \
$(BIN)/test_sepcycle_dup \
$(BIN)/test_separchive_run \
$(BIN)/test_pkgcache_run \
@@ -3122,6 +3123,17 @@ $(BIN)/test_sepdotpath_run: test/wcc/989_sepdotpath_run.c $(BIN)/ww $(BIN)/ww_ww
$(BIN)/w6l $(BIN)/w6l_ww $(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_seproot_export_run — sep-build of a ROOT whose `export fn` references an
# unexported LOCAL type (#69, BUG-1): the producer must NOT pass `-I` for the
# root, since `-I` triggers check_exported_type, which rejects that legal
# terminal-binary pattern. Drives BOTH driver stages + replays the forced
# `-I` reject directly on the produced root unit (both compilers), so it needs
# both driver + both compiler + both linker stages + libwwrt for the link.
$(BIN)/test_seproot_export_run: test/wcc/989_seproot_export_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_sepcycle_dup — M3-tail commit-4 negative gates (#46, #31): a loud
# dep-cycle reject (both driver stages, cs==ww stderr) + the #31
# duplicate-symbol reject (both linker stages). Needs both driver stages,