wcc/ww: try-unwrap str success reads the stamped operand type

The ?/! success-is-str decision was name-keyed off the FIRST variant
and only handled call operands — an ident operand with junk registers
unwrapped garbage, and error-first unions picked the wrong variant.
Key on the stamped success variant (successvariant + typeisstr,
mirror cgen.c:10459-10466/10595-10602). Review item #16.
This commit is contained in:
2026-06-13 01:44:27 +09:00
parent 75c1b278e6
commit 36e17b58f2
5 changed files with 204 additions and 204 deletions

View File

@@ -255,6 +255,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_tagtupfieldsize_run \
$(BIN)/test_arrlit_tail_zero_run \
$(BIN)/test_defdim_slice_run \
$(BIN)/test_trystr_run \
$(BIN)/test_gunsigned_run \
$(BIN)/test_taggedidx_run \
$(BIN)/test_fnptrcollide_run \
@@ -734,6 +735,17 @@ $(BIN)/test_defdim_slice_run: test/wcc/989_defdim_slice_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_trystr_run (#16): `?`/`!` unwrap of a str-success tagged union shuffles
# the str header for ANY operand shape + variant order, keyed off the stamped
# operand type (not a name-keyed call-only first-variant lookup). Builds+runs
# on BOTH driver twins (rule-10).
$(BIN)/test_trystr_run: test/wcc/989_trystr_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_gunsigned_run (F7-c5, #25): a module-global unsigned ident on the
# divide/shift/relational path must pick the unsigned opcode. Builds+runs on
# BOTH driver twins (rule-10). CLASS-M — see the test header.