commit f059f8b1cf415a7fba36f6b96206bb3d6776e41d
parent 9639940cb46f0f8b5dcd872e99a9801df742f24c
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 19 Apr 2020 16:31:57 -0700
amd64: Use member class for aggregate parameter temporary
Otherwise, we may end up using an integer and floating class for the
same register, triggering an assertion failure:
qbe: rega.c:215: pmrec: Assertion `KBASE(pm[i].cls) == KBASE(*k)' failed.
Test case:
type :T = { s }
export
function $d(:T %.1, s %.2) {
@start
call $c(s %.2)
ret
}
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/amd64/sysv.c b/amd64/sysv.c
@@ -467,10 +467,10 @@ selpar(Fn *fn, Ins *i0, Ins *i1)
}
r = rarg(a->cls[0], &ni, &ns);
if (i->op == Oparc) {
- emit(Ocopy, Kl, a->ref[0], r, R);
+ emit(Ocopy, a->cls[0], a->ref[0], r, R);
if (a->size > 8) {
r = rarg(a->cls[1], &ni, &ns);
- emit(Ocopy, Kl, a->ref[1], r, R);
+ emit(Ocopy, a->cls[1], a->ref[1], r, R);
}
} else
emit(Ocopy, i->cls, i->to, r, R);