wcc/ww: def-dim array slice takes len and cap from the type table

Slicing an array whose dimension is a def constant gave len 0 — the
default-hi and cgbasecap arms only read an N_INTLIT dimension. Route
the dimension through the type table (one root, four arms: default-hi
and cgbasecap, local and global each), byte-identical for the def-dim
SLICE shape. The def-dim array .len/.ptr FIELD-read keeps the
N_INTLIT-only limitation — filed as task #56 (cgdot sibling).
Review item #21.
This commit is contained in:
2026-06-13 00:21:21 +09:00
parent ffb858bba6
commit 75c1b278e6
5 changed files with 387 additions and 66 deletions

View File

@@ -254,6 +254,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_tupfieldsize_run \
$(BIN)/test_tagtupfieldsize_run \
$(BIN)/test_arrlit_tail_zero_run \
$(BIN)/test_defdim_slice_run \
$(BIN)/test_gunsigned_run \
$(BIN)/test_taggedidx_run \
$(BIN)/test_fnptrcollide_run \
@@ -723,6 +724,16 @@ $(BIN)/test_arrlit_tail_zero_run: test/wcc/989_arrlit_tail_zero_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
# 989_defdim_slice_run (#21): slicing a `def`-dimensioned array (`[MAX]T`)
# resolves length + capacity from the type table, not the AST dim node.
# Builds+runs on BOTH driver twins (rule-10), pinning the absolute value.
$(BIN)/test_defdim_slice_run: test/wcc/989_defdim_slice_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.