~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
2 2

[PATCH harec] gen: dealias object type in slice assignment

Details
Message ID
<20230920205710.19761-1-bgs@turminal.net>
DKIM signature
pass
Download raw message
Patch: +7 -1
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
---
 src/gen.c          | 2 +-
 tests/08-slices.ha | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gen.c b/src/gen.c
index 0ed2489..03ea6f7 100644
--- a/src/gen.c
+++ b/src/gen.c
@@ -783,7 +783,7 @@ gen_expr_assign_slice(struct gen_context *ctx, const struct expression *expr)
	struct qbe_value vptr = mkqtmp(ctx, ctx->arch.ptr, ".%d");
	pushi(ctx->current, &optr, Q_LOADL, &qobj, NULL);
	pushi(ctx->current, &vptr, Q_LOADL, &qval, NULL);
	tmp = constl(expr->assign.object->result->array.members->size);
	tmp = constl(vtype->array.members->size);
	pushi(ctx->current, &olen, Q_MUL, &olen, &tmp, NULL);
	pushi(ctx->current, NULL, Q_CALL, &ctx->rt.memmove, &optr, &vptr, &olen, NULL);

diff --git a/tests/08-slices.ha b/tests/08-slices.ha
index b24ebf4..63ac661 100644
--- a/tests/08-slices.ha
+++ b/tests/08-slices.ha
@@ -85,6 +85,8 @@ fn zero3(s: []int) void = {
	s[..] = [0, 0, 0];
};

type sl_alias = []int;

fn assignment() void = {
	let source = [1, 2, 3];
	let x: []int = source;
@@ -108,6 +110,10 @@ fn assignment() void = {
	assert(z[0] == 1 && z[1] == 42 && z[2] == 69 && z[3] == 1337 && z[4] == 5);
	z[2..5] = y;
	assert(z[0] == 1 && z[1] == 42 && z[2] == 0 && z[3] == 0 && z[4] == 0);
	let z: sl_alias = z;
	z[2..5] = y;
	let z: *sl_alias = &z;
	z[2..5] = y;

	let x: []int = [];
	let opaqueslice: []opaque = x;
-- 
2.38.4

[harec/patches] build success

builds.sr.ht <builds@sr.ht>
Details
Message ID
<CVO1FZMZ86R6.1S01GMT5IQ3IL@cirno2>
In-Reply-To
<20230920205710.19761-1-bgs@turminal.net> (view parent)
DKIM signature
missing
Download raw message
harec/patches: SUCCESS in 1m25s

[gen: dealias object type in slice assignment][0] from [Bor Grošelj Simić][1]

[0]: https://lists.sr.ht/~sircmpwn/hare-dev/patches/44910
[1]: bgs@turminal.net

✓ #1060515 SUCCESS harec/patches/freebsd.yml https://builds.sr.ht/~sircmpwn/job/1060515
✓ #1060516 SUCCESS harec/patches/netbsd.yml  https://builds.sr.ht/~sircmpwn/job/1060516
✓ #1060514 SUCCESS harec/patches/alpine.yml  https://builds.sr.ht/~sircmpwn/job/1060514
Details
Message ID
<CVRMDPD4NK2W.22ZNGUJC68ML1@monch>
In-Reply-To
<20230920205710.19761-1-bgs@turminal.net> (view parent)
DKIM signature
pass
Download raw message
thanks!

to git@git.sr.ht:~sircmpwn/harec
  6151bd6..a3687cb  master -> master
Reply to thread Export thread (mbox)