public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [lto] a small patch
@ 2007-10-29 16:08 Nathan Froyd
  0 siblings, 0 replies; only message in thread
From: Nathan Froyd @ 2007-10-29 16:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: zadeck

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
problems.

Committed to the LTO branch.

-Nathan

2007-10-29  Nathan Froyd  <froydnj@codesourcery.com>

	* 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.  */

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-29 15:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-29 16:08 [lto] a small patch Nathan Froyd

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).