wcc/cgen: GAP-A.ptr global-array base — LEAQ name(SB) not (BP) (#11, both stages)
A global fixed array's .ptr (= &A[0]) must take the SB base, but cstage emitted frame-relative LEAQ off(BP) for BOTH let- and def-global arrays -> *A.ptr read frame garbage (0 instead of the element). cstage-SILENT; wwstage def-global was a loud link-error. The .ptr read arm now gates off==0 && (let_islet || def_isarraydef) -> LEAQ name(SB), reusing the def-array index base predicate (cgen.c:4367, the #94/#231/#48 class). Locals (off != 0) stay BP-relative -- the 14 toolchain backing-ptr sites unaffected. wwstage let-global was already correct; this adds the missing def-global arm (cgenexpr.ww), converging cstage/wwstage byte-identical across all three flavors (local / let-global / def-global) and closing a latent cstage-only let-global cs!=ww divergence. Byte-id 990-997 8/8 (corpus has no global .ptr); w6c/w6c_ww binaries move (cgen changed). test/wcc/818 table-driven, build+run+byte-id per flavor.
This commit is contained in:
7
Makefile
7
Makefile
@@ -244,6 +244,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_arr_tagged_elem \
|
||||
$(BIN)/test_arr_infer_len \
|
||||
$(BIN)/test_arr_cap_reject \
|
||||
$(BIN)/test_arr_ptr_global \
|
||||
$(BIN)/test_def_arr_infer_len \
|
||||
$(BIN)/test_def_arr_len \
|
||||
$(BIN)/test_slice_str_global_zero \
|
||||
@@ -642,6 +643,12 @@ $(BIN)/test_arr_cap_reject: test/wcc/817_arr_cap_reject.c $(BIN)/ww \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_arr_ptr_global: test/wcc/818_arr_ptr_global.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_arr_infer_len: test/wcc/814_def_arr_infer_len.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