summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2007-02-09 01:11:18 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2007-02-09 01:11:18 +0000
commit46bd2beed4c78dcb32fcde4913815527c14e5e17 (patch)
tree0c7d195e64cf1a546187b71d49c8c44bdca1041f /gcc/expr.c
parent687e00ee8a88d034fb91a9eecb611b5927c5f677 (diff)
downloadgcc-46bd2beed4c78dcb32fcde4913815527c14e5e17.tar.gz
calls.c (store_one_arg): Pass correct alignment to emit_push_insn for non-BLKmode values.
* calls.c (store_one_arg): Pass correct alignment to emit_push_insn for non-BLKmode values. * expr.c (emit_push_insn): If STRICT_ALIGNMENT, copy to an unaligned stack slot via a suitably aligned slot. From-SVN: r121736
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index b49813ab2a9..a04e931acd0 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -3643,7 +3643,8 @@ emit_push_insn (rtx x, enum machine_mode mode, tree type, rtx size,
xinner = x;
- if (mode == BLKmode)
+ if (mode == BLKmode
+ || (STRICT_ALIGNMENT && align < GET_MODE_ALIGNMENT (mode)))
{
/* Copy a block into the stack, entirely or partially. */
@@ -3655,6 +3656,20 @@ emit_push_insn (rtx x, enum machine_mode mode, tree type, rtx size,
offset = partial % (PARM_BOUNDARY / BITS_PER_UNIT);
used = partial - offset;
+ if (mode != BLKmode)
+ {
+ /* A value is to be stored in an insufficiently aligned
+ stack slot; copy via a suitably aligned slot if
+ necessary. */
+ size = GEN_INT (GET_MODE_SIZE (mode));
+ if (!MEM_P (xinner))
+ {
+ temp = assign_temp (type, 0, 1, 1);
+ emit_move_insn (temp, xinner);
+ xinner = temp;
+ }
+ }
+
gcc_assert (size);
/* USED is now the # of bytes we need not copy to the stack