commit 905e9cef302727fdaacd7069826ff448c2d88361
parent c7842d84da65bcaf2d3c82aa69fb3ec930c7369f
Author: Quentin Carbonneaux <quentin@c9x.me>
Date: Mon, 14 Mar 2022 09:59:14 +0100
arm64/abi: fix big aggregates passed on the stack
The riscv test abi8.ssa caught a bug
in the arm backend. It turns out we
were using the wrong class when loading
pointers to aggregates from the stack.
The fix is simple and mirrors what is
done in the riscv abi.
Diffstat:
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/arm64/abi.c b/arm64/abi.c
@@ -100,6 +100,9 @@ typclass(Class *c, Typ *t, int *gp, int *fp)
* memory */
c->class |= Cptr;
c->size = 8;
+ c->ngp = 1;
+ *c->reg = *gp;
+ *c->cls = Kl;
return;
}
@@ -230,14 +233,7 @@ argsclass(Ins *i0, Ins *i1, Class *carg, Ref *env)
case Oparc:
case Oargc:
typclass(c, &typ[i->arg[0].val], gp, fp);
- if (c->class & Cptr) {
- if (ngp > 0) {
- ngp--;
- *c->reg = *gp++;
- *c->cls = Kl;
- break;
- }
- } else if (c->ngp <= ngp) {
+ if (c->ngp <= ngp) {
if (c->nfp <= nfp) {
ngp -= c->ngp;
nfp -= c->nfp;