re PR middle-end/65315 (incorrect alignment of local variable with aligned attribute)
authorSteve Ellcey <sellcey@imgtec.com>
Thu, 5 Mar 2015 16:34:03 +0000 (16:34 +0000)
committerSteve Ellcey <sje@gcc.gnu.org>
Thu, 5 Mar 2015 16:34:03 +0000 (16:34 +0000)
2015-03-05  Steve Ellcey  <sellcey@imgtec.com>

PR middle-end/65315
* cfgexpand.c (expand_stack_vars): Update large_align to maximum
needed alignment.

From-SVN: r221219

gcc/ChangeLog
gcc/cfgexpand.c

index cfacea1775bc499a4b664e5641325bfaea9c039e..368a7d04887ad7da1183e1780cb49ac52682f792 100644 (file)
@@ -1,3 +1,9 @@
+2015-03-05  Steve Ellcey  <sellcey@imgtec.com>
+
+       PR middle-end/65315
+       * cfgexpand.c (expand_stack_vars): Update large_align to maximum
+       needed alignment.
+
 2015-03-05  Martin Liska  <mliska@suse.cz>
 
        * ipa-inline.c (inline_small_functions): Set default value to
index 7dfe1f6e7f52f420d9a1ada3862728653b9cae99..569cd0d2390786b5486d486cdb9410aaf6110c9e 100644 (file)
@@ -973,6 +973,13 @@ expand_stack_vars (bool (*pred) (size_t), struct stack_vars_data *data)
          i = stack_vars_sorted[si];
          alignb = stack_vars[i].alignb;
 
+         /* All "large" alignment decls come before all "small" alignment
+            decls, but "large" alignment decls are not sorted based on
+            their alignment.  Increase large_align to track the largest
+            required alignment.  */
+         if ((alignb * BITS_PER_UNIT) > large_align)
+           large_align = alignb * BITS_PER_UNIT;
+
          /* Stop when we get to the first decl with "small" alignment.  */
          if (alignb * BITS_PER_UNIT <= MAX_SUPPORTED_STACK_ALIGNMENT)
            break;