From 09b58383a159c9bb4e47f7c44fbc2895bc9a3130 Mon Sep 17 00:00:00 2001 From: hubicka Date: Fri, 18 Mar 2005 14:57:10 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@96685 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/varasm.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) (limited to 'gcc/varasm.c') diff --git a/gcc/varasm.c b/gcc/varasm.c index 2f16f7e6057..5392dae3a5e 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -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) -- cgit v1.2.1