This is the mail archive of the 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] a small patch

The below patch fixes two small problems: we weren't initializing
DECL_RESULT before merging function declarations, leading to problems,
and we were unconditionally saving things on the list of unmaterialized
decls, thereby storing error_mark_node on the list, leading to more

Committed to the LTO branch.


2007-10-29  Nathan Froyd  <>

	* lto.c (lto_read_subroutine_type_subprogram_DIE): Build the
	RESULT_DECL slightly earlier.  Only remember the decl for later
	if we successfully merge declarations.

Index: gcc/lto/lto.c
--- gcc/lto/lto.c	(revision 129580)
+++ gcc/lto/lto.c	(working copy)
@@ -2600,6 +2600,10 @@ lto_read_subroutine_type_subprogram_DIE 
          information in the DIE.  */
       SET_DECL_ASSEMBLER_NAME (result, asm_name ? asm_name : name);
+      DECL_RESULT (result)
+	= build_decl (RESULT_DECL, NULL_TREE,
+		      TYPE_MAIN_VARIANT (ret_type));
       /* If the function has already been declared, merge the
 	 declarations.  */
       result = lto_symtab_merge_fn (result);
@@ -2609,13 +2613,9 @@ lto_read_subroutine_type_subprogram_DIE 
              resolved from the bodies of functions.  */
           lto_cache_store_DIE (fd, die, result);
-          DECL_RESULT (result)
-            = build_decl (RESULT_DECL, NULL_TREE,
-                          TYPE_MAIN_VARIANT (ret_type));
+	  /* Save it for later.  */
+	  VEC_safe_push (tree, heap, fd->unmaterialized_fndecls, result);
-      /* Save it for later.  */
-      VEC_safe_push (tree, heap, fd->unmaterialized_fndecls, result);
   /* Read the child DIEs, which are in the scope of RESULT.  */

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