This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[lto][patch] Clear DECL_CONTEXT of nested functions


When lto1 reconstructs a node, the cgraph_node checks DECL_CONTEXT and
if it  is a FUNCTION_DECL the node is nested. This is undesirable,
since in cc1 the node was already unnested by lower_nested_functions.

This patch clears DECL_CONTEXT on reset_decl_lang_specific.
OK for lto?

2008-10-22 Rafael Espindola  <espindola@google.com>

	* tree.c (reset_decl_lang_specific): Clear DECL_CONTEXT of inline
	functions.

Cheers,
-- 
Rafael Avila de Espindola

Google | Gordon House | Barrow Street | Dublin 4 | Ireland
Registered in Dublin, Ireland | Registration Number: 368047
diff --git a/gcc/tree.c b/gcc/tree.c
index 2201c07..c060c1b 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -4044,6 +4044,12 @@ reset_decl_lang_specific (void **slot, void *unused ATTRIBUTE_UNUSED)
 	  DECL_SIZE (decl) = NULL_TREE;
 	}
     }
+  else if (TREE_CODE (decl) == FUNCTION_DECL)
+    {
+      tree context = DECL_CONTEXT (decl);
+      if (context && TREE_CODE (context) == FUNCTION_DECL)
+	DECL_CONTEXT (decl) = NULL_TREE;
+    }
   else if (TREE_CODE (decl) == VAR_DECL)
     {
       tree expr = DECL_DEBUG_EXPR (decl);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]