]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR middle-end/36701 (unaligned access in gcc.c-torture/execute/complex-7.c)
authorH.J. Lu <hongjiu.lu@intel.com>
Wed, 13 Aug 2008 16:20:42 +0000 (16:20 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Wed, 13 Aug 2008 16:20:42 +0000 (09:20 -0700)
2008-08-13  H.J. Lu  <hongjiu.lu@intel.com>

PR middle-end/36701
* expr.c (emit_group_store): Allocate stack temp with the
largest alignment when copying from register to stack.

From-SVN: r139062

gcc/ChangeLog
gcc/expr.c

index fa88d55ee27f45576a4dd7548551d7be2b0623f5..d74b64aee3a9b76b306caa110e85711845f3f2e4 100644 (file)
@@ -1,3 +1,9 @@
+2008-08-13  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR middle-end/36701
+       * expr.c (emit_group_store): Allocate stack temp with the
+       largest alignment when copying from register to stack.
+
 2008-08-13  Richard Guenther  <rguenther@suse.de>
 
        * tree.h (maybe_fold_offset_to_address): Declare.
index e61dc616165094ed30022404dd801ee74814a556..7cc8783e0bca1a13aa0cb8f13d9995aa88e82fc0 100644 (file)
@@ -2074,12 +2074,31 @@ emit_group_store (rtx orig_dst, rtx src, tree type ATTRIBUTE_UNUSED, int ssize)
            }
          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]);
-             dst = dest;
+             enum machine_mode dest_mode = GET_MODE (dest);
+             enum machine_mode tmp_mode = GET_MODE (tmps[i]);
+             int dest_size = GET_MODE_SIZE (dest_mode);
+             int tmp_size = GET_MODE_SIZE (tmp_mode);
+
+             gcc_assert (bytepos == 0
+                         && XVECLEN (src, 0)
+                         && dest_size == tmp_size);
+
+             if (GET_MODE_ALIGNMENT (dest_mode)
+                 >= GET_MODE_ALIGNMENT (tmp_mode))
+               {
+                 dest = assign_stack_temp (dest_mode, dest_size, 0);
+                 emit_move_insn (adjust_address (dest,
+                                                 tmp_mode,
+                                                 bytepos),
+                                 tmps[i]);
+                 dst = dest;
+               }
+             else
+               {
+                 dest = assign_stack_temp (tmp_mode, tmp_size, 0);
+                 emit_move_insn (dest, tmps[i]);
+                 dst = adjust_address (dest, dest_mode, bytepos);
+               }
              break;
            }
        }