diff options
author | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-17 17:49:30 +0000 |
---|---|---|
committer | hjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-09-17 17:49:30 +0000 |
commit | f64dc32ddc942587f5f2fc6a2968ecd50328c16f (patch) | |
tree | 2ba7a5b55ed477ffff8998549dfefde466f44b35 /gcc/cfgexpand.c | |
parent | 41c3fcada49bf862ee3b7daacbe27d554cf152a8 (diff) | |
download | gcc-f64dc32ddc942587f5f2fc6a2968ecd50328c16f.tar.gz |
Update stack alignment when increasing local variable alignment.
gcc/
2010-09-17 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/45678
* cfgexpand.c (update_stack_alignment): New.
(get_decl_align_unit): Use it.
(expand_one_stack_var_at): Call update_stack_alignment.
gcc/testsuite/
2010-09-17 H.J. Lu <hongjiu.lu@intel.com>
PR middle-end/45678
* gcc.dg/torture/pr45678-2.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164375 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index 42372769049..1e67e778978 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -205,19 +205,11 @@ static bool has_protected_decls; smaller than our cutoff threshold. Used for -Wstack-protector. */ static bool has_short_buffer; -/* Discover the byte alignment to use for DECL. Ignore alignment - we can't do with expected alignment of the stack boundary. */ +/* Update stack alignment requirement. */ -static unsigned int -get_decl_align_unit (tree decl) +static void +update_stack_alignment (unsigned int align) { - unsigned int align; - - align = LOCAL_DECL_ALIGNMENT (decl); - - if (align > MAX_SUPPORTED_STACK_ALIGNMENT) - align = MAX_SUPPORTED_STACK_ALIGNMENT; - if (SUPPORTS_STACK_ALIGNMENT) { if (crtl->stack_alignment_estimated < align) @@ -233,6 +225,22 @@ get_decl_align_unit (tree decl) crtl->stack_alignment_needed = align; if (crtl->max_used_stack_slot_alignment < align) crtl->max_used_stack_slot_alignment = align; +} + +/* Discover the byte alignment to use for DECL. Ignore alignment + we can't do with expected alignment of the stack boundary. */ + +static unsigned int +get_decl_align_unit (tree decl) +{ + unsigned int align; + + align = LOCAL_DECL_ALIGNMENT (decl); + + if (align > MAX_SUPPORTED_STACK_ALIGNMENT) + align = MAX_SUPPORTED_STACK_ALIGNMENT; + + update_stack_alignment (align); return align / BITS_PER_UNIT; } @@ -735,6 +743,7 @@ expand_one_stack_var_at (tree decl, HOST_WIDE_INT offset) if (align == 0 || align > max_align) align = max_align; + update_stack_alignment (align); DECL_ALIGN (decl) = align; DECL_USER_ALIGN (decl) = 0; } |