wcc_ww/cgen: #55 tagged-source arg-widen into wider tagged slot (align-up)

wwstage pushargsrev treated a narrower tagged-union argument widened into
a wider tagged param slot as a concrete variant: taggedvariantindex<0
clamped the tag to 0 and pushed word0 only (deref/index/dot silent-wrong;
ident ran correct only by prefix-union tag-index luck). cstage is correct
(cg_widen_tagged_push routes src_is_tagged unconditionally); align ww UP.

Three arms in cgenutil.ww, all mirroring cstage cgen.c:
 - slot-gate the ident aistagged short-circuit so a slot-differ tagged
   ident falls to the widen path instead of the raw 2-word push;
 - route a tagged source in the widensz>0 arm through @tagscr +
   cgwidentaggedstore + push high->low (cgen.c cg_widen_tagged_push);
 - cgwidentaggedstore cursor arm (<=32B INDEX/DOT) spills by source
   width, zero-pads, and tag-remaps (cgen.c 2698-2714) — was dst-slot
   spill of stale high regs with no pad and no remap.

Same-slot tagged->tagged is byte-id-neutral by construction (empty pad +
identity remap). cstage untouched; 4 legs x {aligned, misaligned-tag}
converge ww->cs byte-identical. Pin 944_tagged_widen_arg_run.
This commit is contained in:
2026-06-06 15:15:13 +09:00
parent 00d9580c9f
commit cc896bd078
5 changed files with 465 additions and 15 deletions

View File

@@ -310,6 +310,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_alias_amp_idx_run \
$(BIN)/test_alias_def_addr_run \
$(BIN)/test_def_amp_idx_run \
$(BIN)/test_tagged_widen_arg_run \
$(BIN)/test_alias_global_decl_run \
$(BIN)/test_alias_cgen_b5_run \
$(BIN)/test_alias_cgen_b6_run \
@@ -1518,6 +1519,12 @@ $(BIN)/test_def_amp_idx_run: test/wcc/944_def_amp_idx_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_tagged_widen_arg_run: test/wcc/944_tagged_widen_arg_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_alias_global_decl_run: test/wcc/944_alias_global_decl_run.c \
$(BIN)/ww $(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \