wcc/cgen: #19+#22 uniform index element-size for non-ident bases (wwstage)
Indexing a non-ident pointer-yielding base -- a direct cast ((&a):*[4]u32)[i], a call result mk(&a)[i], a slice, a type-assertion -- used wwstage's default 8-byte element stride/load instead of the real element type's, reading garbage (cast-base i32 index: cs=30, ww=0). The cgindex esz derivation gated on a whitelist of base node-kinds (DOT / UN-deref / INDEX); an N_CAST/N_CALL/N_SLICE/N_TYPEASSERT base matched none. Rather than extend the whitelist (whack-a-mole), this mirrors cstage's uniform idx_eff read: N_INDEX keeps its own arm (chained-index byte-id preserved), and every other non-ident base now derives esz/stride/load- width/signedness from the stamped n.type_ -- closing the class by construction (base set ident/dot/un/index/cast/call/slice/typeassert). cstage was already correct (uniform); w6c md5 unchanged. byte-id 990-997 8/8, no lib pin flips. test/wcc/830 (9 base shapes, byte-id per width, signed + unsigned). Folds the N_CALL sibling #22.
This commit is contained in:
7
Makefile
7
Makefile
@@ -530,6 +530,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_sort_run \
|
||||
$(BIN)/test_bufio_run $(BIN)/test_random_run \
|
||||
$(BIN)/test_asserttyped_gap \
|
||||
$(BIN)/test_cast_base_index \
|
||||
$(BIN)/test_ascii_run $(BIN)/test_tok_run $(BIN)/test_nkname_run
|
||||
|
||||
$(BIN)/test_smoke: test/wcc/000_smoke.c $(LIB)/libwcc.a | $(BIN)
|
||||
@@ -660,6 +661,12 @@ $(BIN)/test_arr_ptr_global: test/wcc/818_arr_ptr_global.c $(BIN)/ww \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_cast_base_index: test/wcc/830_cast_base_index.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_def_str_index_reject: test/wcc/821_def_str_index_reject.c $(BIN)/ww \
|
||||
$(BIN)/w6c $(BIN)/w6a $(BIN)/w6l \
|
||||
$(BIN)/ww_ww $(BIN)/w6c_ww $(BIN)/w6a_ww $(BIN)/w6l_ww \
|
||||
|
||||
Reference in New Issue
Block a user