diff options
author | Jan Hubicka <jh@suse.cz> | 2003-09-09 22:27:52 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2003-09-09 20:27:52 +0000 |
commit | cd4dea6224cb7e3ef2daa9253e5b670af74091e3 (patch) | |
tree | 2240007b0242ee14c6f75de7f63f07ad346bc5a7 | |
parent | 892955bff08d660ba36d42e32f3b7a0c7d3acd61 (diff) | |
download | gcc-cd4dea6224cb7e3ef2daa9253e5b670af74091e3.zip gcc-cd4dea6224cb7e3ef2daa9253e5b670af74091e3.tar.gz gcc-cd4dea6224cb7e3ef2daa9253e5b670af74091e3.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cgraphunit.c | 44 |
2 files changed, 33 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6754c80..49a3826 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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 diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index a41182f..10bf837 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -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 (); |