From: Steve Ellcey Date: Thu, 5 Mar 2015 16:34:03 +0000 (+0000) Subject: re PR middle-end/65315 (incorrect alignment of local variable with aligned attribute) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a8eeec27a94869785782a2d98969b437c4c5d62e;p=gcc.git re PR middle-end/65315 (incorrect alignment of local variable with aligned attribute) 2015-03-05 Steve Ellcey PR middle-end/65315 * cfgexpand.c (expand_stack_vars): Update large_align to maximum needed alignment. From-SVN: r221219 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cfacea1775b..368a7d04887 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-03-05 Steve Ellcey + + PR middle-end/65315 + * cfgexpand.c (expand_stack_vars): Update large_align to maximum + needed alignment. + 2015-03-05 Martin Liska * ipa-inline.c (inline_small_functions): Set default value to diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 7dfe1f6e7f5..569cd0d2390 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -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;