The following avoids running into issues with the AACPS ABI on arm
when using over-aligned types on registers.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2015-03-31  Richard Biener  <rguent...@suse.de>

        * tree-sra.c (create_access_replacement): Drop under-/over-alignment
        of types.

Index: gcc/tree-sra.c
===================================================================
--- gcc/tree-sra.c      (revision 221770)
+++ gcc/tree-sra.c      (working copy)
@@ -2012,7 +2012,11 @@ create_access_replacement (struct access
       DECL_CONTEXT (repl) = current_function_decl;
     }
   else
-    repl = create_tmp_var (access->type, "SR");
+    /* Drop any special alignment on the type if it's not on the main
+       variant.  This avoids issues with weirdo ABIs like AAPCS.  */
+    repl = create_tmp_var (build_qualified_type
+                            (TYPE_MAIN_VARIANT (access->type),
+                             TYPE_QUALS (access->type)), "SR");
   if (TREE_CODE (access->type) == COMPLEX_TYPE
       || TREE_CODE (access->type) == VECTOR_TYPE)
     {

Reply via email to