wcc: address-of symbol-bearing def + cross-module module-qual (#149)
Widen cgaddr / N_UN TK_AMP for addressable globals — the address-of twin of A.2/A.3's value-LOAD widening (which covered cgexpr N_DOT / cgindex but never the &-path, so &<mod>.<def> emitted uninitialized-AX garbage). Two shapes, one class: - Shape 1 (&G, N_IDENT def): LEAQ masym(G) for struct/array/scalar defs. Scalar gate = emit_defs/emit_floatlit_data eligibility exactly (fold_int_literal OR rhs-peels-to-N_FLOATLIT) so the addressable set equals the symbol-bearing set — never LEAQs a missing symbol. Reuses DefStruct/DefArray registries (A.2/A.3); new def_isscalardef/DefAny. - Shape 2 (&mod.G, N_DOT module-qual): LEAQ leaf (TY_FN -> mafn), mirroring the value-READ resolution (cgen.c:6043). Kind-agnostic — fixes &mod.def, &mod.let, &mod.scalar, &mod.func. This is fold-4's &math.f64info pattern. Non-addressable def (str-def, computed-float-def) -> loud error both stages; upgrades #147 &NAN(0.0/0.0) from silent wild-deref to loud compile error. Computed-float-def symbol emission split to #147 (needs float-const-fold; not needed by gamma/fold-4). wwstage Shape-2 gate carries !deflookup so a def base routes to silent-drop matching cstage's type-gate (rule-10 parity). Unblocks gamma-cleanup (#40) + strconv fold-4 (&math.f64info). Bootstrap-NEUTRAL (no &global in lib/selfhost; only &local). Test 921 (12 rows: same-pkg struct/array/scalar-int/scalar-float + cross-pkg def_struct/let_struct/scalar_let/func + regression &let/&arr[i] + 2 loud-reject). Make test: 184/184 incl 990-997 byte-id + combined_ww_fresh. Followups: #147 (computed-float-def symbol), #152/#153 (pre-existing ptr-param element read divergences, dodged by 921), #154 (address-of def subparts &def.field/&def_array[i]).
This commit is contained in:
6
Makefile
6
Makefile
@@ -343,6 +343,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_struct_composite_init_run \
|
||||
$(BIN)/test_array_static_init_run \
|
||||
$(BIN)/test_array_init_acceptiffits_run \
|
||||
$(BIN)/test_amp_def_global_run \
|
||||
$(BIN)/test_f64cgen_run \
|
||||
$(BIN)/test_f64crossmod_run \
|
||||
$(BIN)/test_tuprecv_run \
|
||||
@@ -1171,6 +1172,11 @@ $(BIN)/test_array_init_acceptiffits_run: test/wcc/920_array_init_acceptiffits_ru
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_amp_def_global_run: test/wcc/921_amp_def_global_run.c \
|
||||
$(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww $(BIN)/w6a $(BIN)/w6l \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_f64cgen_run: test/wcc/951_f64cgen_run.c $(BIN)/ww $(BIN)/w6c \
|
||||
$(BIN)/w6a $(BIN)/w6l $(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
Reference in New Issue
Block a user