cgen: default the hi bound of an N_DOT array-field slice arg
pushargsrev's N_SLICE arm resolved esz and the base address from the stamped tinfo of an N_DOT [N]T-field base but let the omitted hi bound fall to $0, so the #258 array-to-slice borrow desugar handed callees a zero-length slice: base64 clear()'s bytes.zero(e.ibuf) was a runtime no-op under the wwstage frontend. Take the element count from the field's array tinfo like the cgslice #252 arm and cstage's bu->alen. Graduates r989_libprecond_decodedsize_aligned and the 989_lib_byteid #59.3 base64 pin.
This commit is contained in:
2
Makefile
2
Makefile
@@ -586,7 +586,7 @@ DATABYTEID_EXPECTED_MIN = 911
|
|||||||
DATABYTEID_DIVERGED = r71_tagged_return_scratch_mixed \
|
DATABYTEID_DIVERGED = r71_tagged_return_scratch_mixed \
|
||||||
r76_typeeq_fn_diff_arity r76_typeeq_fn_diff_param_type \
|
r76_typeeq_fn_diff_arity r76_typeeq_fn_diff_param_type \
|
||||||
r76_typeeq_fn_io_vtable_shape r76_typeeq_fn_variadic_vs_fixed \
|
r76_typeeq_fn_io_vtable_shape r76_typeeq_fn_variadic_vs_fixed \
|
||||||
r940_str_forrange_arg r989_libprecond_decodedsize_aligned
|
r940_str_forrange_arg
|
||||||
$(if $(DATABYTEID_FILES),,$(error test-byteid: empty data corpus))
|
$(if $(DATABYTEID_FILES),,$(error test-byteid: empty data corpus))
|
||||||
test-data-byteid: $(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww
|
test-data-byteid: $(BIN)/ww $(BIN)/w6c $(BIN)/w6c_ww
|
||||||
@work=$$(mktemp -d "$(CURDIR)/$(DATABYTEID_DIR).XXXXXX") || exit 1; \
|
@work=$$(mktemp -d "$(CURDIR)/$(DATABYTEID_DIR).XXXXXX") || exit 1; \
|
||||||
|
|||||||
@@ -774,9 +774,17 @@ fn pushargsrev(c: *cgen, arg: *syntax.node, param: *syntax.node, memphase: bool,
|
|||||||
emitline("\tMOVQ\t8(CX), AX\n");
|
emitline("\tMOVQ\t8(CX), AX\n");
|
||||||
};};
|
};};
|
||||||
};
|
};
|
||||||
|
} else { if (dotbu != nil && dotbu.kind == syntax.tykind.TY_ARRAY) {
|
||||||
|
// #252 twin: default-hi over an N_DOT `[N]T`-field base —
|
||||||
|
// element count from the field's array tinfo (cstage reads
|
||||||
|
// bu->alen uniformly). Without this the #258 array→slice
|
||||||
|
// borrow desugar handed callees a 0-length slice.
|
||||||
|
emitline("\tMOVQ\t$");
|
||||||
|
emitint(dotbu.alen: i64);
|
||||||
|
emitline(", AX\n");
|
||||||
} else {
|
} else {
|
||||||
emitline("\tMOVQ\t$0, AX\n");
|
emitline("\tMOVQ\t$0, AX\n");
|
||||||
};};};
|
};};};};
|
||||||
emitline("\tPUSHQ\tAX\n");
|
emitline("\tPUSHQ\tAX\n");
|
||||||
// lo (default 0) → AX
|
// lo (default 0) → AX
|
||||||
if (lo != nil) { cgexpr(c, lo); }
|
if (lo != nil) { cgexpr(c, lo); }
|
||||||
|
|||||||
@@ -145,8 +145,10 @@ static const struct ent ents[] = {
|
|||||||
{ .fixture = "lib/ascii/asciitest.ww",
|
{ .fixture = "lib/ascii/asciitest.ww",
|
||||||
.mode = M_ID, .cite = "#59.1 graduated by #146 str==" },
|
.mode = M_ID, .cite = "#59.1 graduated by #146 str==" },
|
||||||
/* #59.2 bufio graduated to M_ID above (#129 fix) */
|
/* #59.2 bufio graduated to M_ID above (#129 fix) */
|
||||||
|
/* #59.3 base64 graduated to M_ID (pushargsrev N_DOT array-field
|
||||||
|
* default-hi fix — clear()'s borrow no longer zero-length) */
|
||||||
{ .fixture = "lib/encoding/base64/base64_test.ww",
|
{ .fixture = "lib/encoding/base64/base64_test.ww",
|
||||||
.mode = M_DIVERGE, .cite = "#59.3" },
|
.mode = M_ID },
|
||||||
/* #59.4 hextest graduated to M_ID above (#22a reviewer fixes) */
|
/* #59.4 hextest graduated to M_ID above (#22a reviewer fixes) */
|
||||||
{ .fixture = "lib/errors/errnotest.ww",
|
{ .fixture = "lib/errors/errnotest.ww",
|
||||||
.mode = M_DIVERGE, .cite = "#59.5" },
|
.mode = M_DIVERGE, .cite = "#59.5" },
|
||||||
|
|||||||
Reference in New Issue
Block a user