wcc/ww: reject compound *p OP= v through a *tagged, like cstage (#18)

The wwstage compound-deref arm narrowed the store for scalar pointees and
otherwise emitted a single MOVQ, so `*p OP= v` with p:*tagged clobbered
one word (the tag) and returned -- silently miscompiling what cstage
already rejects. A compound op on a whole union is nonsense. Gate the arm
on a scalar pointee size and let a tagged pointee fall through to the
existing assign-resolver reject, the byte-id twin of the cstage fatal.
cstage is unchanged.

This closes the deref member of the compound-on-tagged class; the index
and ident members (gs[i] OP= v, g OP= v) reject in a follow-up (#20/#21).
This commit is contained in:
2026-06-14 00:40:34 +09:00
parent 323607d1d0
commit 769be55905
5 changed files with 308 additions and 3 deletions

View File

@@ -253,6 +253,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_intoverflow_reject \
$(BIN)/test_unknowndecl_reject \
$(BIN)/test_nullableglobal_reject \
$(BIN)/test_taggedcompoundderef_reject \
$(BIN)/test_idxarg_run \
$(BIN)/test_chainidx_run \
$(BIN)/test_tupfieldsize_run \
@@ -738,6 +739,21 @@ $(BIN)/test_nullableglobal_reject: test/wcc/989_nullableglobal_reject.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_taggedcompoundderef_reject (#18, last of the tagged-payload WRITE
# class): `*p OP= v` where p is a *tagged is nonsense and must loud-reject.
# cstage already gated (sz>=16 falls to the assign-resolver fatal); wwstage
# silently miscompiled (single MOVQ on the tag word). The align-down adds
# the same size gate so both stages reach the identical resolver reject.
# Reject rows assert build-fail + shared diagnostic; control rows (scalar
# compound + #17 plain deref store) build + run. Needs both tool sets +
# libwwrt for the control links.
$(BIN)/test_taggedcompoundderef_reject: test/wcc/989_taggedcompoundderef_reject.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_idxarg_run (F7-c2, #45/#46): an indexed slice/str element passed as
# a call arg must push its full multi-word header. Builds+runs each fixture
# on BOTH the cstage `ww` and wwstage `ww_ww` drivers (rule-10), so it needs