summaryrefslogtreecommitdiff
path: root/gcc/c-decl.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-10 03:16:49 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-10 03:16:49 +0000
commitc59f0ae977803b3cf52ef4a3cb7bbb8d307c8c0f (patch)
tree9ffc01c1b2a2946921e1d0edd9595558de9cd0ef /gcc/c-decl.c
parent3862c4a7a79ca962872794d26593cb05d4c91bf3 (diff)
downloadgcc-c59f0ae977803b3cf52ef4a3cb7bbb8d307c8c0f.tar.gz
* c-decl.c (finish_function): When processing a nested function,
push and pop GC context around rest_of_compilation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29255 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-decl.c')
-rw-r--r--gcc/c-decl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index 1acb1601264..33c004252ff 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -6928,9 +6928,18 @@ finish_function (nested)
/* So we can tell if jump_optimize sets it to 1. */
can_reach_end = 0;
+ /* If this is a nested function, protect the local variables in the stack
+ above us from being collected while we're compiling this function. */
+ if (ggc_p && nested)
+ ggc_push_context ();
+
/* Run the optimizers and output the assembler code for this function. */
rest_of_compilation (fndecl);
+ /* Undo the GC context switch. */
+ if (ggc_p && nested)
+ ggc_pop_context ();
+
current_function_returns_null |= can_reach_end;
if (warn_missing_noreturn