public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Fix cgraph ICE with aliases (PR middle-end/48044)
@ 2011-03-11 14:50 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2011-03-11 14:50 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jan Hubicka

Hi!

I've committed this fix, where cgraph_remove_unreachable_nodes
was clearing vnode->needed for nodes marked as force_output
because something was aliasing them.  For -O1 the varpool nodes
were removed completely (also undesirable), but for -O0 they
were kept around and ICEd because needed wasn't set in them.

Bootstrapped/regtested on x86_64-linux and i686-linux, approved by Honza on
IRC.

2011-03-11  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/48044
	* ipa.c (cgraph_remove_unreachable_nodes): Enqueue
	all vnode->force_output nodes as needed.

	* gcc.dg/torture/pr48044.c: New test.

--- gcc/ipa.c.jj	2011-01-18 12:20:18.000000000 +0100
+++ gcc/ipa.c	2011-03-11 12:27:04.000000000 +0100
@@ -259,7 +259,7 @@ cgraph_remove_unreachable_nodes (bool be
     {
       vnode->next_needed = NULL;
       vnode->prev_needed = NULL;
-      if (vnode->analyzed
+      if ((vnode->analyzed || vnode->force_output)
 	  && !varpool_can_remove_if_no_refs (vnode))
 	{
 	  vnode->needed = false;
--- gcc/testsuite/gcc.dg/torture/pr48044.c.jj	2011-03-11 12:28:59.000000000 +0100
+++ gcc/testsuite/gcc.dg/torture/pr48044.c	2011-03-11 12:28:48.000000000 +0100
@@ -0,0 +1,7 @@
+/* PR middle-end/48044 */
+/* { dg-do compile } */
+/* { dg-require-alias "" } */
+
+int a __asm__ ("b") = 0;
+extern int c __asm__ ("a") __attribute__ ((alias ("b")));
+extern int d __attribute__ ((weak, alias ("a")));

	Jakub

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

only message in thread, other threads:[~2011-03-11 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-11 14:50 [committed] Fix cgraph ICE with aliases (PR middle-end/48044) Jakub Jelinek

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