[lto] fix valgrind error and uniquify function names

Nathan Froyd froydnj@codesourcery.com
Tue Dec 18 19:24:00 GMT 2007

valgrind was complaining about a use of an uninitialized variable.  We
also need to set the assembler names of non-public functions to avoid
conflicts between static functions and/or variables in different
compilation units.  It's possible this last bit wreaks havoc with
user-defined assembler names for functions; I'm not going to worry about
that at the moment.

Committed to the LTO branch.


2007-12-18  Nathan Froyd  <froydnj@codesourcery.com>

	* lto.c (lto_read_subroutine_type_subprogram_DIE): Initialize
	'declaration'.  Set the assembler name for non-public functions.

Index: lto.c
--- lto.c	(revision 131038)
+++ lto.c	(working copy)
@@ -2465,6 +2465,7 @@ lto_read_subroutine_type_subprogram_DIE 
   prototyped = false;
   name = NULL_TREE;
   external = false;
+  declaration = false;
   saved_scope = NULL_TREE;
   if (abbrev->tag == DW_TAG_subroutine_type)
@@ -2673,6 +2674,11 @@ lto_read_subroutine_type_subprogram_DIE 
 	  DECL_EXTERNAL (result) = 1;
+      if (!TREE_PUBLIC (result))
+	/* Need to ensure static entities between different files
+	   don't clash unexpectedly.  */
+	lang_hooks.set_decl_assembler_name (result);
       /* If the function has already been declared, merge the
 	 declarations.  */
       result = lto_symtab_merge_fn (result);

More information about the Gcc-patches mailing list