OSDN Git Service

* cgraphunit.c (cgraph_finalize_function): Fix handling of extern
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2003 20:27:52 +0000 (20:27 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 9 Sep 2003 20:27:52 +0000 (20:27 +0000)
inline functions.
(cgraph_finalize_compilation_unit): Fix crash when dealing with lost
DECL_SAVED_TREE.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71245 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cgraphunit.c

index 6754c80..49a3826 100644 (file)
@@ -1,3 +1,10 @@
+Tue Sep  9 22:18:48 CEST 2003  Jan Hubicka  <jh@suse.cz>
+
+       * cgraphunit.c (cgraph_finalize_function): Fix handling of extern
+       inline functions.
+       (cgraph_finalize_compilation_unit): Fix crash when dealing with lost
+       DECL_SAVED_TREE.
+
 2003-09-09  Roger Sayle  <roger@eyesopen.com>
 
        * builtins.c (fold_builtin_cabs): Protect the complex argument
index a41182f..10bf837 100644 (file)
@@ -160,26 +160,28 @@ cgraph_finalize_function (tree decl, tree body ATTRIBUTE_UNUSED)
         
         ??? It may make more sense to use one body for inlining and other body
         for expanding the function but this is dificult to do.  */
-      if (!node->needed)
+      /* Reset our datastructures so we can analyze the function body
+        again.  */
+      memset (&node->local, 0, sizeof (node->local));
+      memset (&node->global, 0, sizeof (node->global));
+      memset (&node->rtl, 0, sizeof (node->rtl));
+      node->lowered = false;
+      if (node->output)
+       abort ();
+      while (node->callees)
+       cgraph_remove_call (node->decl, node->callees->callee->decl);
+      /* We may need to re-queue the node for assembling in case
+         we already proceeded it and ignored as not needed.  */
+      if (node->reachable && !flag_unit_at_a_time)
        {
-         /* Reset our datastructures so we can analyze the function body
-            again.  */
-         memset (&node->local, 0, sizeof (node->local));
-         memset (&node->global, 0, sizeof (node->global));
-         memset (&node->rtl, 0, sizeof (node->rtl));
-         node->lowered = false;
-         if (node->output)
-           abort ();
-         while (node->callees)
-           cgraph_remove_call (node->decl, node->callees->callee->decl);
+         struct cgraph_node *n;
+
+         for (n = cgraph_nodes_queue; n; n = n->next_needed)
+           if (n == node)
+             break;
+         if (!n)
+           node->reachable = 0;
        }
-      else
-      /* Frontend may call finalize_function twice when it is incorrectly
-         redefined.  */
-      if (errorcount || sorrycount)
-       return;
-      else
-        abort ();
     }
   notice_global_symbol (decl);
   node->decl = decl;
@@ -333,6 +335,12 @@ cgraph_finalize_compilation_unit (void)
       node = cgraph_nodes_queue;
       cgraph_nodes_queue = cgraph_nodes_queue->next_needed;
 
+      /* ??? It is possible to create extern inline function and later using
+        weak alas attribute to kill it's body. See
+        gcc.c-torture/compile/20011119-1.c  */
+      if (!DECL_SAVED_TREE (decl))
+       continue;
+
       if (node->lowered || !node->reachable || !DECL_SAVED_TREE (decl))
        abort ();