aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1993-10-05 22:33:19 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1993-10-05 22:33:19 -0400
commitf52b5958f0ddc9db5cc9f0abcbdfe50bfe8170d3 (patch)
treeec83e276609a7de9f896ef445638d287006f0b5d
parentba2e110c46d90b5c169383265a619b2284957472 (diff)
downloadgcc-f52b5958f0ddc9db5cc9f0abcbdfe50bfe8170d3.zip
gcc-f52b5958f0ddc9db5cc9f0abcbdfe50bfe8170d3.tar.gz
gcc-f52b5958f0ddc9db5cc9f0abcbdfe50bfe8170d3.tar.bz2
(make_node, case 'd'): Refine in which obstack PARM_DECLs are
allocated. From-SVN: r5624
-rw-r--r--gcc/tree.c29
1 files changed, 15 insertions, 14 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index bc4af6e..aafc757 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -792,25 +792,26 @@ make_node (code)
/* All decls in an inline function need to be saved. */
if (obstack != &permanent_obstack)
obstack = saveable_obstack;
- /* PARM_DECLs always go on saveable_obstack, not permanent,
- even though we may make them before the function turns
- on temporary allocation. */
- else if (code == PARM_DECL)
+
+ /* PARM_DECLs go on the context of the parent. If this is a nested
+ function, then we must allocate the PARM_DECL on the parent's
+ 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.
+
+ PARM_DECLs of top-level functions do not have this problem. However,
+ we allocate them where we put the FUNCTION_DECL for languauges such as
+ Ada that need to consult some flags in the PARM_DECLs of the function
+ when calling it. */
+ else if (code == PARM_DECL && obstack != &permanent_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;
+ obstack
+ = find_function_data (context)->function_obstack;
}
break;