summaryrefslogtreecommitdiff
path: root/6
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2012-08-03 01:23:07 -0400
committerOri Bernstein <ori@eigenstate.org>2012-08-03 01:23:07 -0400
commitbdddb0fe46050fc184e0146819e9840611a0e44d (patch)
tree08bd004083790c0d3d9e37e6214eeb86d02e4e78 /6
parentc7606d65d33f37e853755930e5559c7c4aa4a554 (diff)
downloadmc-bdddb0fe46050fc184e0146819e9840611a0e44d.tar.gz
Align the function arguments properly in calls.
Diffstat (limited to '6')
-rw-r--r--6/isel.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/6/isel.c b/6/isel.c
index 4ccf6d7..b4a7584 100644
--- a/6/isel.c
+++ b/6/isel.c
@@ -382,8 +382,10 @@ static Loc *gencall(Isel *s, Node *n)
* Not good.
*
* We skip the first operand, since it's the function itself */
- for (i = 1; i < n->expr.nargs; i++)
+ for (i = 1; i < n->expr.nargs; i++) {
+ argsz = align(argsz, min(size(n->expr.args[i]), Ptrsz));
argsz += size(n->expr.args[i]);
+ }
stkbump = loclit(argsz, ModeQ);
if (argsz)
g(s, Isub, stkbump, rsp, NULL);
@@ -392,6 +394,7 @@ static Loc *gencall(Isel *s, Node *n)
argoff = 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));
if (stacknode(n->expr.args[i])) {
dst = locreg(ModeQ);
src = locreg(ModeQ);