wcc: loop-label stack guards its depth loudly, both stages

wwstage's unguarded loop-label push wrote out of bounds at depth 17
(compiler-heap corruption); cstage guarded but emitted a wrong break
target. Loud cap error at the limit, both stages, agreeing wording.
This commit is contained in:
2026-06-13 04:34:36 +09:00
parent 92cd573197
commit f7845057a7
6 changed files with 244 additions and 10 deletions

View File

@@ -261,6 +261,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_defdim_argslice_run \
$(BIN)/test_slttypepref_run \
$(BIN)/test_defercap_run \
$(BIN)/test_loopcap_run \
$(BIN)/test_ampfncollide_run \
$(BIN)/test_trycallcollide_run \
$(BIN)/test_gunsigned_run \
@@ -806,6 +807,16 @@ $(BIN)/test_defercap_run: test/wcc/989_defercap_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_loopcap_run (#42, F13 c2): the loop-label stack fails loud at its cap
# (LOOP_MAX) in BOTH stages instead of an OOB heap write (ww) / wrong jump
# target (cstage). Builds/rejects on both driver twins (rule-10). See header.
$(BIN)/test_loopcap_run: test/wcc/989_loopcap_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).