re PR middle-end/48044 (ICE in function_and_variable_visibility, at ipa.c:875)
authorJakub Jelinek <jakub@redhat.com>
Fri, 11 Mar 2011 14:47:26 +0000 (15:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 11 Mar 2011 14:47:26 +0000 (15:47 +0100)
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.

From-SVN: r170873

gcc/ChangeLog
gcc/ipa.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr48044.c [new file with mode: 0644]

index 4eb1024..1da3589 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2011-03-11  Jason Merrill  <jason@redhat.com>
 
        PR c++/48069
index 0320ded..4955408 100644 (file)
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -1,5 +1,5 @@
 /* Basic IPA optimizations and utilities.
-   Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
+   Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -259,7 +259,7 @@ cgraph_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
     {
       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;
index 54d77a6..6169459 100644 (file)
@@ -1,3 +1,8 @@
+2011-03-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR middle-end/48044
+       * gcc.dg/torture/pr48044.c: New test.
+
 2011-03-11  Janus Weil  <janus@gcc.gnu.org>
 
        PR fortran/47768
diff --git a/gcc/testsuite/gcc.dg/torture/pr48044.c b/gcc/testsuite/gcc.dg/torture/pr48044.c
new file mode 100644 (file)
index 0000000..fe3b734
--- /dev/null
@@ -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")));