re PR target/35366 (gfortran.dg/equiv_7.f90 fails with -m64 -Os on powerpc-apple...
authorJakub Jelinek <jakub@redhat.com>
Wed, 12 Nov 2008 08:16:12 +0000 (09:16 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 12 Nov 2008 08:16:12 +0000 (09:16 +0100)
PR target/35366
* expr.c (expand_expr_addr_expr_1): If EXP needs bigger alignment
than INNER and INNER is a constant, forcibly align INNER as much
as needed.

From-SVN: r141782

gcc/ChangeLog
gcc/expr.c

index 755b33b9a652804a36526f3734e5cd226486e77b..6bb36f5de6fa7beb7422e84ed5dc71210965d50f 100644 (file)
@@ -1,3 +1,10 @@
+2008-11-12  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/35366
+       * expr.c (expand_expr_addr_expr_1): If EXP needs bigger alignment
+       than INNER and INNER is a constant, forcibly align INNER as much
+       as needed.
+
 2008-11-11  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * cse.c (fold_rtx): Remove redundant gen_rtx_CONST.
index 6db637e53bf8536fc53c0bb65ab5bd15baf2eb04..31af3aa9c4920c2ed5b4764f69f927e9d493102c 100644 (file)
@@ -6862,6 +6862,16 @@ expand_expr_addr_expr_1 (tree exp, rtx target, enum machine_mode tmode,
   gcc_assert (inner != exp);
 
   subtarget = offset || bitpos ? NULL_RTX : target;
+  /* For VIEW_CONVERT_EXPR, where the outer alignment is bigger than
+     inner alignment, force the inner to be sufficiently aligned.  */
+  if (CONSTANT_CLASS_P (inner)
+      && TYPE_ALIGN (TREE_TYPE (inner)) < TYPE_ALIGN (TREE_TYPE (exp)))
+    {
+      inner = copy_node (inner);
+      TREE_TYPE (inner) = copy_node (TREE_TYPE (inner));
+      TYPE_ALIGN (TREE_TYPE (inner)) = TYPE_ALIGN (TREE_TYPE (exp));
+      TYPE_USER_ALIGN (TREE_TYPE (inner)) = 1;
+    }
   result = expand_expr_addr_expr_1 (inner, subtarget, tmode, modifier);
 
   if (offset)