wcc: indexed-field compound assignment wires all ten ops, both stages

arr[i].field /= %= <<= >>= silently dropped the op (load-combine-store
emitted plain assignment) in BOTH stages — gate-blind, the #133 class.
Route every compound op through the combine dispatch at the indexed-
field arm and hard-error the unhandled operand kinds (float/str/slice/
tagged), per the #133 template (3986818). The runtime-correct target is
the op's own algebra (a OP= b == a = a OP b). Review item #33.

Both stages move in one commit: the fix is a single emission contract —
splitting cstage cgen.c from selfhost cgenexpr.ww would leave the
byte-id gates red between the halves.
This commit is contained in:
2026-06-12 19:26:24 +09:00
parent 02eb867036
commit 1be0e6b5db
6 changed files with 613 additions and 25 deletions

View File

@@ -322,6 +322,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_tryprop_tag_remap_run \
$(BIN)/test_nullable_try_run \
$(BIN)/test_nullable_assert_run \
$(BIN)/test_idxfield_compound_run \
$(BIN)/test_nested_union_widen_run \
$(BIN)/test_sret_struct_return \
$(BIN)/test_sret_struct_return_run \
@@ -1778,6 +1779,12 @@ $(BIN)/test_nullable_assert_run: test/wcc/949_nullable_assert_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_idxfield_compound_run: test/wcc/949_idxfield_compound_run.c \
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_sret_struct_return: test/wcc/721_sret_struct_return.c \
$(BIN)/w6c $(BIN)/w6c_ww | $(BIN)
$(CC) $(CFLAGS) -o $@ $<