aboutsummaryrefslogtreecommitdiffhomepage
path: root/amd64
diff options
context:
space:
mode:
Diffstat (limited to 'amd64')
-rw-r--r--amd64/isel.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/amd64/isel.c b/amd64/isel.c
index 450d8fd..fefd8ea 100644
--- a/amd64/isel.c
+++ b/amd64/isel.c
@@ -82,6 +82,10 @@ fixarg(union ref *r, struct instr *ins, struct block *blk, int *curi)
wr32le(data, pun.i);
}
*r = mkdatref(NULL, siz, /*align*/siz, data, siz, /*deref*/1);
+ if (&ins->l != r && ins->l.t == RADDR) {
+ /* can't use memory arg in rhs if lhs is memory */
+ *r = insertinstr(blk, (*curi)++, mkinstr(Ocopy, con->cls, *r));
+ }
} else if (in_range(op, Odiv, Ourem) && kisint(ins->cls))
goto DivImm;
} else if (r->t == RICON && in_range(op, Odiv, Ourem) && kisint(ins->cls)) {