summaryrefslogtreecommitdiff
path: root/gcc/cfgexpand.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2010-03-01 08:03:22 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2010-03-01 08:03:22 +0100
commit6c6366f6513dbf11dc563d0a6f420c12d4c48df7 (patch)
tree7d9d41abbe1b5c599c09b9fb6117889098a6c08d /gcc/cfgexpand.c
parent8026c68cce481c763306f8a3d495890a3aab5e4a (diff)
downloadgcc-6c6366f6513dbf11dc563d0a6f420c12d4c48df7.tar.gz
cfgexpand.c (expand_used_vars): If an artificial non-ignored var has no rtl yet when processing local_decls...
* cfgexpand.c (expand_used_vars): If an artificial non-ignored var has no rtl yet when processing local_decls, queue it and recheck if deferred stack allocation hasn't assigned it rtl. From-SVN: r157132
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r--gcc/cfgexpand.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index 7b8df04bed0..b51307ff902 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -1283,6 +1283,7 @@ static void
expand_used_vars (void)
{
tree t, next, outer_block = DECL_INITIAL (current_function_decl);
+ tree maybe_local_decls = NULL_TREE;
unsigned i;
/* Compute the phase of the stack frame for this function. */
@@ -1367,6 +1368,15 @@ expand_used_vars (void)
cfun->local_decls = t;
continue;
}
+ else if (rtl == NULL_RTX)
+ {
+ /* If rtl isn't set yet, which can happen e.g. with
+ -fstack-protector, retry before returning from this
+ function. */
+ TREE_CHAIN (t) = maybe_local_decls;
+ maybe_local_decls = t;
+ continue;
+ }
}
ggc_free (t);
@@ -1425,6 +1435,28 @@ expand_used_vars (void)
fini_vars_expansion ();
}
+ /* If there were any artificial non-ignored vars without rtl
+ found earlier, see if deferred stack allocation hasn't assigned
+ rtl to them. */
+ for (t = maybe_local_decls; t; t = next)
+ {
+ tree var = TREE_VALUE (t);
+ rtx rtl = DECL_RTL_IF_SET (var);
+
+ next = TREE_CHAIN (t);
+
+ /* Keep artificial non-ignored vars in cfun->local_decls
+ chain until instantiate_decls. */
+ if (rtl && (MEM_P (rtl) || GET_CODE (rtl) == CONCAT))
+ {
+ TREE_CHAIN (t) = cfun->local_decls;
+ cfun->local_decls = t;
+ continue;
+ }
+
+ ggc_free (t);
+ }
+
/* If the target requires that FRAME_OFFSET be aligned, do it. */
if (STACK_ALIGNMENT_NEEDED)
{