summaryrefslogtreecommitdiff
path: root/gcc/varasm.c
diff options
context:
space:
mode:
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-24 22:06:37 +0000
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>2005-04-24 22:06:37 +0000
commit880afb804d8c8dd903dacb8c3e1383a80eba225c (patch)
treeceb41f874d3b1e3d612a3d2785020f503973c21a /gcc/varasm.c
parent37f365e40bb5019ddbc2feb1828501587dc6b43b (diff)
downloadgcc-880afb804d8c8dd903dacb8c3e1383a80eba225c.tar.gz
PR middle-end/20991
* cgraph.h (cgraph_local_info): Add vtable_method field. * varasm.c (mark_decl_referenced): If cgraph_global_info_ready and node is vtable_method, finalized and not reachable, don't do anything. * class.c: Include cgraph.h. (cp_fold_obj_type_ref): Set node->local.vtable_method. * Make-lang.in (cgraph.o): Depend on $(CGRAPH_H). * g++.dg/opt/pr20991.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@98674 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varasm.c')
-rw-r--r--gcc/varasm.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/varasm.c b/gcc/varasm.c
index 86d386e0ff8..bab9437ec0a 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -1955,9 +1955,15 @@ mark_decl_referenced (tree decl)
{
if (TREE_CODE (decl) == FUNCTION_DECL)
{
- /* Extern inline functions don't become needed when referenced. */
- if (!DECL_EXTERNAL (decl))
- cgraph_mark_needed_node (cgraph_node (decl));
+ /* Extern inline functions don't become needed when referenced.
+ If we know a method will be emitted in other TU and no new
+ functions can be marked reachable, just use the external
+ definition. */
+ struct cgraph_node *node = cgraph_node (decl);
+ if (!DECL_EXTERNAL (decl)
+ && (!node->local.vtable_method || !cgraph_global_info_ready
+ || !node->local.finalized))
+ cgraph_mark_needed_node (node);
}
else if (TREE_CODE (decl) == VAR_DECL)
{