aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-10-04 14:24:07 +0200
committerRichard Biener <rguenther@suse.de>2021-10-04 18:02:57 +0200
commitd362b91fa655fb02a4214e28eb33b8b60a0e1ace (patch)
treecc0da9ed36568e2d8c1f7b22fea381464ace92f1 /gcc/gimplify.c
parentc86a16b07b76604a8e3d556f135babab80e2b747 (diff)
downloadgcc-d362b91fa655fb02a4214e28eb33b8b60a0e1ace.zip
gcc-d362b91fa655fb02a4214e28eb33b8b60a0e1ace.tar.gz
gcc-d362b91fa655fb02a4214e28eb33b8b60a0e1ace.tar.bz2
avoid hardreg autoinit
This avoids initializating "uninitialized" hardregs like SP. 2021-10-04 Richard Biener <rguenther@suse.de> * gimplify.c (is_var_need_auto_init): DECL_HARD_REGISTER variables are not to be initialized. * gcc.dg/auto-init-hardreg-1.c: New testcase.
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index f4bc649..b27776a 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1825,6 +1825,8 @@ static bool
is_var_need_auto_init (tree decl)
{
if (auto_var_p (decl)
+ && (TREE_CODE (decl) != VAR_DECL
+ || !DECL_HARD_REGISTER (decl))
&& (flag_auto_var_init > AUTO_INIT_UNINITIALIZED)
&& (!lookup_attribute ("uninitialized", DECL_ATTRIBUTES (decl)))
&& !is_empty_type (TREE_TYPE (decl)))