Commit 3e755d23 by Jim Wilson

(finish_decl): When saving/discarding initializers,

don't check TREE_PERMANENT and TREE_STATIC.
(finish_decl, finish_function): Pass new argument to
permanent_allocation.

From-SVN: r6722
parent bb98bc58
...@@ -3558,8 +3558,11 @@ finish_decl (decl, init, asmspec_tree) ...@@ -3558,8 +3558,11 @@ finish_decl (decl, init, asmspec_tree)
} }
/* ??? After 2.3, test (init != 0) instead of TREE_CODE. */ /* ??? After 2.3, test (init != 0) instead of TREE_CODE. */
/* This test used to include TREE_PERMANENT, however, we have the same
problem with initializers at the function level. Such initializers get
saved until the end of the function on the momentary_obstack. */
if (!(TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl)) if (!(TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl))
&& temporary && TREE_PERMANENT (decl) && temporary
/* DECL_INITIAL is not defined in PARM_DECLs, since it shares /* DECL_INITIAL is not defined in PARM_DECLs, since it shares
space with DECL_ARG_TYPE. */ space with DECL_ARG_TYPE. */
&& TREE_CODE (decl) != PARM_DECL) && TREE_CODE (decl) != PARM_DECL)
...@@ -3572,10 +3575,12 @@ finish_decl (decl, init, asmspec_tree) ...@@ -3572,10 +3575,12 @@ finish_decl (decl, init, asmspec_tree)
to have a copy of the top-level decl's DECL_INLINE. */ to have a copy of the top-level decl's DECL_INLINE. */
if (DECL_INITIAL (decl) != 0) if (DECL_INITIAL (decl) != 0)
{ {
/* If this is a static const variable, then preserve the /* If this is a const variable, then preserve the
initializer instead of discarding it so that we can optimize initializer instead of discarding it so that we can optimize
references to it. */ references to it. */
if (TREE_STATIC (decl) && TREE_READONLY (decl)) /* This test used to include TREE_STATIC, but this won't be set
for function level initializers. */
if (TREE_READONLY (decl))
{ {
preserve_initializer (); preserve_initializer ();
/* Hack? Set the permanent bit for something that is permanent, /* Hack? Set the permanent bit for something that is permanent,
...@@ -3616,7 +3621,7 @@ finish_decl (decl, init, asmspec_tree) ...@@ -3616,7 +3621,7 @@ finish_decl (decl, init, asmspec_tree)
/* If we have gone back from temporary to permanent allocation, /* If we have gone back from temporary to permanent allocation,
actually free the temporary space that we no longer need. */ actually free the temporary space that we no longer need. */
if (temporary && !allocation_temporary_p ()) if (temporary && !allocation_temporary_p ())
permanent_allocation (); permanent_allocation (0);
/* At the end of a declaration, throw away any variable type sizes /* At the end of a declaration, throw away any variable type sizes
of types defined inside that declaration. There is no use of types defined inside that declaration. There is no use
...@@ -6545,7 +6550,7 @@ finish_function (nested) ...@@ -6545,7 +6550,7 @@ finish_function (nested)
/* Switch back to allocating nodes permanently /* Switch back to allocating nodes permanently
until we start another function. */ until we start another function. */
if (! nested) if (! nested)
permanent_allocation (); permanent_allocation (1);
if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested) if (DECL_SAVED_INSNS (fndecl) == 0 && ! nested)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment