summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-09-14 14:44:10 -0700
committerOri Bernstein <ori@eigenstate.org>2015-09-14 14:44:10 -0700
commita4bcc9067518182c6de7d335c7adc1b4cc2bfb90 (patch)
treea2e1c0e58e4613cfa0e5638d77d3a46be693129b /6
parentd42f32137f5a59e229b6b0e086e9b2502f5c729d (diff)
downloadmc-a4bcc9067518182c6de7d335c7adc1b4cc2bfb90.tar.gz
Fix alignment of function args.
Diffstat (limited to '6')
-rw-r--r--6/isel.c4
-rw-r--r--6/typeinfo.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/6/isel.c b/6/isel.c
index 6cc8ab2..8935d31 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -555,13 +555,13 @@ static Loc *gencall(Isel *s, Node *n)
vararg = 0;
for (i = 1; i < n->expr.nargs; i++) {
arg = selexpr(s, n->expr.args[i]);
- argoff = align(argoff, min(size(n->expr.args[i]), Ptrsz));
+ argoff = alignto(argoff, exprtype(n->expr.args[i]));
if (i > nargs)
vararg = 1;
if (stacknode(n->expr.args[i])) {
src = locreg(ModeQ);
g(s, Ilea, arg, src, NULL);
- a = alignto(1, n->expr.args[i]->expr.type);
+ a = tyalign(exprtype(n->expr.args[i]));
blit(s, rsp, src, argoff, 0, size(n->expr.args[i]), a);
argoff += size(n->expr.args[i]);
} else if (!vararg && isfloatmode(arg->mode) && nfloats < Nfloatregargs) {
diff --git a/6/typeinfo.c b/6/typeinfo.c
index 3ceca1b..f6e6219 100644
--- a/6/typeinfo.c
+++ b/6/typeinfo.c
@@ -327,7 +327,7 @@ size_t tyalign(Type *ty)
default:
align = tysize(ty);
}
- return align;
+ return min(align, Ptrsz);
}
/* gets the byte offset of 'memb' within the aggregate type 'aggr' */