Patchwork Fix PR53476

login
register
mail settings
Submitter Richard Guenther
Date Dec. 13, 2012, 3:17 p.m.
Message ID <alpine.LNX.2.00.1212131616030.14089@zhemvz.fhfr.qr>
Download mbox | patch
Permalink /patch/206116/
State New
Headers show

Comments

Richard Guenther - Dec. 13, 2012, 3:17 p.m.
This fixes the weak alias regression FAIL: gcc.dg/attr-weakref-1.c.
I tracked it down to the fact that this has both DECL_EXTERNAL
and TREE_STATIC (and RTL) set but the trunk code differs from the
4.7 code in that it has an additional !DECL_EXTERNAL check
(for no apparent reason, that is, no testcase or comment).

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.

Richard.

2012-12-13  Richard Biener  <rguenther@suse.de>

	PR middle-end/53476
	* varpool.c (varpool_remove_unreferenced_decls): Revert to 4.7
	behavior.

Patch

Index: gcc/varpool.c
===================================================================
--- gcc/varpool.c	(revision 194473)
+++ gcc/varpool.c	(working copy)
@@ -358,8 +358,7 @@  varpool_remove_unreferenced_decls (void)
 	  && (!varpool_can_remove_if_no_refs (node)
 	      /* We just expanded all function bodies.  See if any of
 		 them needed the variable.  */
-	      || (!DECL_EXTERNAL (node->symbol.decl)
-		  && DECL_RTL_SET_P (node->symbol.decl))))
+	      || DECL_RTL_SET_P (node->symbol.decl)))
 	{
 	  enqueue_node (node, &first);
           if (cgraph_dump_file)