diff mbox

Fix PR52400

Message ID alpine.LNX.2.00.1202271638530.18230@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Feb. 27, 2012, 3:40 p.m. UTC
This fixes PR52400 - we cannot register renamed decl mappings when
we can have name duplicates.  Which we trivially can have with
local fn decls.  At least the reverse mapping should no longer be
necessary as the alias pair handling has been rewritten to work
on the cgraph level.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2012-02-27  Richard Guenther  <rguenther@suse.de>

	PR lto/52400
	* lto.c (lto_register_function_decl_in_symtab): Do not register
	a reverse renamed decl mapping.

	* g++.dg/lto/pr52400_0.C: New testcase.
diff mbox

Patch

Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c	(revision 184591)
+++ gcc/lto/lto.c	(working copy)
@@ -689,13 +689,6 @@  lto_register_function_decl_in_symtab (st
 	  lto_record_renamed_decl (data_in->file_data,
 				   IDENTIFIER_POINTER (old_assembler_name),
 				   IDENTIFIER_POINTER (new_assembler_name));
-
-	  /* Also register the reverse mapping so that we can find the
-	     new name given to an existing assembler name (used when
-	     restoring alias pairs in input_constructors_or_inits.  */
-	  lto_record_renamed_decl (data_in->file_data,
-				   IDENTIFIER_POINTER (new_assembler_name),
-				   IDENTIFIER_POINTER (old_assembler_name));
 	}
     }
 
Index: gcc/testsuite/g++.dg/lto/pr52400_0.C
===================================================================
--- gcc/testsuite/g++.dg/lto/pr52400_0.C	(revision 0)
+++ gcc/testsuite/g++.dg/lto/pr52400_0.C	(revision 0)
@@ -0,0 +1,18 @@ 
+// { dg-lto-do run }
+
+extern "C" {
+  static int f4(int);
+
+int f5(int a) {
+  extern int f4(int);
+  return f4(a);
+}
+}
+
+int f4(int a) { return 4+a; }
+
+int main(int argc, char *argv[])
+{
+  int a = f4(1);
+  return !(a == 5);
+}