wcc/cgen: #145 slice-copy-assign LHS s.arr[lo:hi]=bs — N_SLICE-LHS arm, runtime byte-copy loop, esz via type table (both stages)

Probe-first find for the path c2 appendlit (buf.buf[lo..hi]=bs): a
slice-copy-assign into a struct-field array sub-range emitted ZERO code —
silent NO-OP, both stages, both-wrong-identical (#263), so runtime is the
only net. N_ASSIGN gains an N_SLICE-LHS arm (cgen.c + cgenexpr.ww
slicebaseesz twin) reusing the N_SLICE-read base/esz cascade and copying
(hi-lo)*esz bytes from rhs.ptr via a runtime loop (len is runtime; no
REP/MOVSB). esz routed through the type table (rule 13; [N]u8->1). Hare
len(bs)==hi-lo assert deferred to #149.
This commit is contained in:
2026-06-08 09:58:22 +09:00
parent f1dcd4ecae
commit 6e1d958d9b
6 changed files with 541 additions and 0 deletions

View File

@@ -466,6 +466,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
$(BIN)/test_ptrarr_index_run \
$(BIN)/test_dotbase_arr_run \
$(BIN)/test_dotbase_addr_slice_run \
$(BIN)/test_slicecopy_assign_run \
$(BIN)/test_structlit_arrfield_run \
$(BIN)/test_defdim_struct_run \
$(BIN)/test_arraytoslice_run \
@@ -2129,6 +2130,11 @@ $(BIN)/test_dotbase_addr_slice_run: test/wcc/949_dotbase_addr_slice_run.c \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_slicecopy_assign_run: test/wcc/952_slicecopy_assign_run.c \
$(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6l \
$(LIB)/libwwrt.a | $(BIN)
$(CC) $(CFLAGS) -o $@ $<
$(BIN)/test_structlit_arrfield_run: test/wcc/949_structlit_arrfield_run.c \
$(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6l \
$(LIB)/libwwrt.a | $(BIN)