wcc: defer capacity 32 with a loud cap error, both stages

wwstage capped defers at 16 and SILENTLY DROPPED the 17th; cstage
capped at 32. Align the cap at 32 and make exceeding it a loud
compile error in BOTH stages — the silent 16-vs-32 split was the bug
(a defer that never runs is a leaked resource). Both stages move in
one commit: one cap contract.
This commit is contained in:
2026-06-13 04:31:12 +09:00
parent 1f2bc7fc26
commit 92cd573197
7 changed files with 230 additions and 15 deletions

View File

@@ -260,6 +260,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_defdim_field_run \
$(BIN)/test_defdim_argslice_run \
$(BIN)/test_slttypepref_run \
$(BIN)/test_defercap_run \
$(BIN)/test_ampfncollide_run \
$(BIN)/test_trycallcollide_run \
$(BIN)/test_gunsigned_run \
@@ -794,6 +795,17 @@ $(BIN)/test_slttypepref_run: test/wcc/989_slttypepref_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_defercap_run (#40, F13 c1): the defer stack fails loud at its shared
# cap (32) in BOTH stages instead of silently dropping the overflowing
# deferred call (wwstage was capped at 16). Builds/rejects on both driver
# twins (rule-10). See the test header.
$(BIN)/test_defercap_run: test/wcc/989_defercap_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_ampfncollide_run (#4, c2): `&fn` synthesis (unoptype TK_AMP +
# assignableaddrfn) prefers the current module's fn when a same-leaf fn is
# declared in a later module. Builds/rejects on BOTH driver twins (rule-10).