aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-09-09 16:20:32 -0700
committerJim Wilson <wilson@gcc.gnu.org>1993-09-09 16:20:32 -0700
commite97b2a1c481e9b269e2defb75d85aa39b037412d (patch)
treebf9d41b3af342325defc4d25e17384563e9ab944 /gcc
parentb857971992fa7803222152bf7f4a5975a2f9145d (diff)
downloadgcc-e97b2a1c481e9b269e2defb75d85aa39b037412d.zip
gcc-e97b2a1c481e9b269e2defb75d85aa39b037412d.tar.gz
gcc-e97b2a1c481e9b269e2defb75d85aa39b037412d.tar.bz2
(make_node): Put PARM_DECLs of nested functions onto
parent's saveable obstack. From-SVN: r5299
Diffstat (limited to 'gcc')
-rw-r--r--gcc/tree.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 317e8ad..7fd8296 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -796,7 +796,22 @@ make_node (code)
even though we may make them before the function turns
on temporary allocation. */
else if (code == PARM_DECL)
- obstack = function_maybepermanent_obstack;
+ {
+ tree context = 0;
+ if (current_function_decl)
+ context = decl_function_context (current_function_decl);
+ /* If this is a nested function, then we must allocate the PARM_DECL
+ on the parent's saveable_obstack, so that they will live to the
+ end of the parent's closing brace. This is neccesary in case we
+ try to inline the function into its parent. */
+ if (context)
+ {
+ struct function *p = find_function_data (context);
+ obstack = p->function_maybepermanent_obstack;
+ }
+ else
+ obstack = function_maybepermanent_obstack;
+ }
break;
case 't': /* a type node */