selfhost/cmd/wcc: cgalloc str-field store + regression test
wwstage cgalloc N_STRUCTLIT branch emitted MOVQ AX,foff(BX) for every non-float field. For a str field the cgexpr result is (AX=ptr, BX=len) and the single MOVQ clobbered BX with the heap pointer, dropping len. Mirror cmd/w6c/cgen.c:4184-4190: isstrtype branch routes through CX so BX=len survives. TY_STR only — slice/tagged/fn-pair have the same gap on both stages (task #23, parked behind Phase 2). New test/wcc/758_cgalloc_str_field.c is table-driven (6 rows), fails without the fix under wwstage with predicted exit codes.
This commit is contained in:
7
Makefile
7
Makefile
@@ -292,6 +292,7 @@ TESTS = $(BIN)/test_smoke $(BIN)/test_lex $(BIN)/test_parse $(BIN)/test_check \
|
||||
$(BIN)/test_amp_dot_idx \
|
||||
$(BIN)/test_alias_chain_unwrap \
|
||||
$(BIN)/test_letbind_void_bang_void \
|
||||
$(BIN)/test_cgalloc_str_field \
|
||||
$(BIN)/test_param_shadow_mod \
|
||||
$(BIN)/test_localoff_scope \
|
||||
$(BIN)/test_cast_enum_movl \
|
||||
@@ -769,6 +770,12 @@ $(BIN)/test_letbind_void_bang_void: test/wcc/757_letbind_void_bang_void.c \
|
||||
$(LIB)/libwwrt.a | $(BIN)
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
||||
|
||||
$(BIN)/test_cgalloc_str_field: test/wcc/758_cgalloc_str_field.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_match_4arm_cross_module_run: test/wcc/929_match_4arm_cross_module_run.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