diff options
Diffstat (limited to 'gcc/cfgexpand.c')
-rw-r--r-- | gcc/cfgexpand.c | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index d9e9835..06111cc 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1440,7 +1440,7 @@ estimated_stack_frame_size (void) static void expand_used_vars (void) { - tree t, outer_block = DECL_INITIAL (current_function_decl); + tree t, next, outer_block = DECL_INITIAL (current_function_decl); /* Compute the phase of the stack frame for this function. */ { @@ -1453,11 +1453,15 @@ expand_used_vars (void) /* At this point all variables on the local_decls with TREE_USED set are not associated with any block scope. Lay them out. */ - for (t = cfun->local_decls; t; t = TREE_CHAIN (t)) + t = cfun->local_decls; + cfun->local_decls = NULL_TREE; + for (; t; t = next) { tree var = TREE_VALUE (t); bool expand_now = false; + next = TREE_CHAIN (t); + /* We didn't set a block for static or extern because it's hard to tell the difference between a global variable (re)declared in a local scope, and one that's really declared there to @@ -1484,9 +1488,25 @@ expand_used_vars (void) TREE_USED (var) = 1; if (expand_now) - expand_one_var (var, true, true); + { + expand_one_var (var, true, true); + if (DECL_ARTIFICIAL (var) && !DECL_IGNORED_P (var)) + { + rtx rtl = DECL_RTL_IF_SET (var); + + /* 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); } - cfun->local_decls = NULL_TREE; /* At this point, all variables within the block tree with TREE_USED set are actually used by the optimized function. Lay them out. */ |