Patchwork Fix variable symbol renaming

login
register
mail settings
Submitter Jan Hubicka
Date Aug. 22, 2013, 3:06 p.m.
Message ID <20130822150642.GC11005@kam.mff.cuni.cz>
Download mbox | patch
Permalink /patch/269089/
State New
Headers show

Comments

Jan Hubicka - Aug. 22, 2013, 3:06 p.m.
Hi,
this was noticed by the ODR verifier.  For variables we get unique_name wrong
because we first bring it local and then test if it is global.
This makes the ODR unification based on aassembler name to go wrong.

Bootstrapped/regtested x86_64-linux, will commit it shortly.

	* ipa.c (function_and_variable_visibility): First remember function was global
	and then make it local.

Patch

Index: ipa.c
===================================================================
--- ipa.c	(revision 201919)
+++ ipa.c	(working copy)
@@ -968,10 +968,10 @@  function_and_variable_visibility (bool w
 	  && !vnode->symbol.weakref)
 	{
 	  gcc_assert (in_lto_p || whole_program || !TREE_PUBLIC (vnode->symbol.decl));
-	  symtab_make_decl_local (vnode->symbol.decl);
 	  vnode->symbol.unique_name = ((vnode->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY
 				       || vnode->symbol.resolution == LDPR_PREVAILING_DEF_IRONLY_EXP)
 				       && TREE_PUBLIC (vnode->symbol.decl));
+	  symtab_make_decl_local (vnode->symbol.decl);
 	  if (vnode->symbol.same_comdat_group)
 	    symtab_dissolve_same_comdat_group_list ((symtab_node) vnode);
 	  vnode->symbol.resolution = LDPR_PREVAILING_DEF_IRONLY;