This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/36701] [4.4 Regression] unaligned access in gcc.c-torture/execute/complex-7.c
- From: "hjl dot tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Jul 2008 19:55:15 -0000
- Subject: [Bug target/36701] [4.4 Regression] unaligned access in gcc.c-torture/execute/complex-7.c
- References: <bug-36701-682@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #9 from hjl dot tools at gmail dot com 2008-07-08 19:55 -------
When emit_group_store allocates stack temp to copy from register
to stack, it should use the mode with the largest alignment. Does
this patch make sense?
--- expr.c.align 2008-07-02 11:56:29.000000000 -0700
+++ expr.c 2008-07-08 12:48:40.000000000 -0700
@@ -2074,10 +2074,28 @@ emit_group_store (rtx orig_dst, rtx src,
else
{
gcc_assert (bytepos == 0 && XVECLEN (src, 0));
- dest = assign_stack_temp (GET_MODE (dest),
- GET_MODE_SIZE (GET_MODE (dest)), 0);
- emit_move_insn (adjust_address (dest, GET_MODE (tmps[i]),
bytepos),
- tmps[i]);
+ enum machine_mode dest_mode = GET_MODE (dest);
+ enum machine_mode tmp_mode = GET_MODE (tmps[i]);
+
+ if (GET_MODE_ALIGNMENT (dest_mode)
+ >= GET_MODE_ALIGNMENT (tmp_mode))
+ {
+ dest = assign_stack_temp (dest_mode,
+ GET_MODE_SIZE (dest_mode),
+ 0);
+ emit_move_insn (adjust_address (dest,
+ tmp_mode,
+ bytepos),
+ tmps[i]);
+ }
+ else
+ {
+ dest = assign_stack_temp (tmp_mode,
+ GET_MODE_SIZE (dest_mode),
+ 0);
+ emit_move_insn (dest, tmps[i]);
+ dest = adjust_address (dest, dest_mode, bytepos);
+ }
dst = dest;
break;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36701