re PR middle-end/20225 (ICE during GC)
authorJan Hubicka <jh@suse.cz>
Fri, 18 Mar 2005 14:57:10 +0000 (15:57 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 18 Mar 2005 14:57:10 +0000 (14:57 +0000)
PR middle-end/20225
* cgraph.c (cgraph_mark_reachable_node): Assert that it is not called
too late.
* varasm.c (find_decl_and_mark_needed): Mark needed only when not
called too late.

From-SVN: r96685

gcc/ChangeLog
gcc/cgraph.c
gcc/varasm.c

index a4a37854763e4b701bd6fda5bf8f073d0723e5f4..acc6a1338571fa3af9c29c578f167c70b3f17e58 100644 (file)
@@ -1,3 +1,11 @@
+2005-03-18  Jan Hubicka  <jh@suse.cz>
+
+       PR middle-end/20225
+       * cgraph.c (cgraph_mark_reachable_node): Assert that it is not called
+       too late.
+       * varasm.c (find_decl_and_mark_needed): Mark needed only when not
+       called too late.
+
 2005-03-18  Kazu Hirata  <kazu@cs.umass.edu>
 
        * tree-into-ssa.c (find_idf): Use VEC_quick_push instead of
index dacc70dfb30b026744972006a8ccca7f2e7111c8..c7475c18eb3693a4b39c92d13bf4c869028122a9 100644 (file)
@@ -469,6 +469,7 @@ cgraph_mark_reachable_node (struct cgraph_node *node)
     {
       notice_global_symbol (node->decl);
       node->reachable = 1;
+      gcc_assert (!cgraph_global_info_ready);
 
       node->next_needed = cgraph_nodes_queue;
       cgraph_nodes_queue = node;
index 2f16f7e6057c66f651618c5a5521b86a968edced..5392dae3a5eb6e308f01e71e38b9172e900aa83e 100644 (file)
@@ -4360,17 +4360,22 @@ find_decl_and_mark_needed (tree decl, tree target)
   struct cgraph_node *fnode = NULL;
   struct cgraph_varpool_node *vnode = NULL;
 
-  if (TREE_CODE (decl) == FUNCTION_DECL)
+  /* C++ thunk emitting code produces aliases late in the game.
+     Avoid confusing cgraph code in that case.  */
+  if (!cgraph_global_info_ready)
     {
-      fnode = cgraph_node_for_asm (target);
-      if (fnode == NULL)
-       vnode = cgraph_varpool_node_for_asm (target);
-    }
-  else
-    {
-      vnode = cgraph_varpool_node_for_asm (target);
-      if (vnode == NULL)
-       fnode = cgraph_node_for_asm (target);
+      if (TREE_CODE (decl) == FUNCTION_DECL)
+       {
+         fnode = cgraph_node_for_asm (target);
+         if (fnode == NULL)
+           vnode = cgraph_varpool_node_for_asm (target);
+       }
+      else
+       {
+         vnode = cgraph_varpool_node_for_asm (target);
+         if (vnode == NULL)
+           fnode = cgraph_node_for_asm (target);
+       }
     }
 
   if (fnode)