Commit cd4dea62 by Jan Hubicka Committed by Jan Hubicka

cgraphunit.c (cgraph_finalize_function): Fix handling of extern inline functions.


	* cgraphunit.c (cgraph_finalize_function): Fix handling of extern
	inline functions.
	(cgraph_finalize_compilation_unit): Fix crash when dealing with lost
	DECL_SAVED_TREE.

From-SVN: r71245
parent 892955bf
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> 2003-09-09 Roger Sayle <roger@eyesopen.com>
* builtins.c (fold_builtin_cabs): Protect the complex argument * builtins.c (fold_builtin_cabs): Protect the complex argument
......
...@@ -160,26 +160,28 @@ cgraph_finalize_function (tree decl, tree body ATTRIBUTE_UNUSED) ...@@ -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 ??? It may make more sense to use one body for inlining and other body
for expanding the function but this is dificult to do. */ 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 struct cgraph_node *n;
again. */
memset (&node->local, 0, sizeof (node->local)); for (n = cgraph_nodes_queue; n; n = n->next_needed)
memset (&node->global, 0, sizeof (node->global)); if (n == node)
memset (&node->rtl, 0, sizeof (node->rtl)); break;
node->lowered = false; if (!n)
if (node->output) node->reachable = 0;
abort ();
while (node->callees)
cgraph_remove_call (node->decl, node->callees->callee->decl);
} }
else
/* Frontend may call finalize_function twice when it is incorrectly
redefined. */
if (errorcount || sorrycount)
return;
else
abort ();
} }
notice_global_symbol (decl); notice_global_symbol (decl);
node->decl = decl; node->decl = decl;
...@@ -333,6 +335,12 @@ cgraph_finalize_compilation_unit (void) ...@@ -333,6 +335,12 @@ cgraph_finalize_compilation_unit (void)
node = cgraph_nodes_queue; node = cgraph_nodes_queue;
cgraph_nodes_queue = cgraph_nodes_queue->next_needed; 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)) if (node->lowered || !node->reachable || !DECL_SAVED_TREE (decl))
abort (); abort ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment