aboutsummaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2015-12-11 15:53:24 +0000
committerJan Beulich <jbeulich@gcc.gnu.org>2015-12-11 15:53:24 +0000
commit9d7d6446562e305c085b89b792368301310f3bac (patch)
treed77f563c2a5cfa28caccef30637717356cd82991 /gcc/cfgexpand.c
parent34955216a7af430fddffff00d8f9a501f3786fcd (diff)
downloadgcc-9d7d6446562e305c085b89b792368301310f3bac.zip
gcc-9d7d6446562e305c085b89b792368301310f3bac.tar.gz
gcc-9d7d6446562e305c085b89b792368301310f3bac.tar.bz2
avoid alignment of static variables affecting stack's
Function (or more narrow) scope static variables (as well as others not placed on the stack) should also not have any effect on the stack alignment. I noticed the issue first with Linux'es dynamic_pr_debug() construct using an 8-byte aligned sub-file-scope local variable. According to my checking bad behavior started with 4.6.x (4.5.3 was still okay), but generated code got quite a bit worse as of 4.9.0. gcc/ 2015-12-11 Jan Beulich <jbeulich@suse.com> * cfgexpand.c (expand_one_var): Exit early for static and external variables when adjusting stack alignment related. gcc/testsuite/ 2015-12-11 Jan Beulich <jbeulich@suse.com> * gcc.c-torture/execute/stkalign.c: New. From-SVN: r231569
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 7fe02a9..7f4eba2 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1550,6 +1550,9 @@ expand_one_var (tree var, bool toplevel, bool really_expand)
if (TREE_TYPE (var) != error_mark_node && TREE_CODE (var) == VAR_DECL)
{
+ if (is_global_var (var))
+ return 0;
+
/* Because we don't know if VAR will be in register or on stack,
we conservatively assume it will be on stack even if VAR is
eventually put into register after RA pass. For non-automatic