From ac6a641b41a1c7ee7c50accbffdd54aea8fdd2d5 Mon Sep 17 00:00:00 2001 From: Michael Matz Date: Sun, 3 Apr 2011 11:14:14 +0000 Subject: [PATCH] tree.c (free_lang_data_in_decl): Zero DECL_VINDEX if it's not an integer. * tree.c (free_lang_data_in_decl): Zero DECL_VINDEX if it's not an integer. * tree.h (tree_decl_non_common.vindex): Adjust comment. From-SVN: r171904 --- gcc/ChangeLog | 6 ++++++ gcc/tree.c | 7 +++++++ gcc/tree.h | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a4b56f2400c..4be06bf4a6b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-04-03 Michael Matz + + * tree.c (free_lang_data_in_decl): Zero DECL_VINDEX if it's not + an integer. + * tree.h (tree_decl_non_common.vindex): Adjust comment. + 2011-04-03 Michael Matz * cgraphbuild.c (record_reference): Canonicalize constructor diff --git a/gcc/tree.c b/gcc/tree.c index eec4a8b2905..f1ac7a604ce 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -4647,6 +4647,13 @@ free_lang_data_in_decl (tree decl) && RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (DECL_ABSTRACT_ORIGIN (decl)))) DECL_ABSTRACT_ORIGIN (decl) = NULL_TREE; + + /* Sometimes the C++ frontend doesn't manage to transform a temporary + DECL_VINDEX referring to itself into a vtable slot number as it + should. Happens with functions that are copied and then forgotten + about. Just clear it, it won't matter anymore. */ + if (DECL_VINDEX (decl) && !host_integerp (DECL_VINDEX (decl), 0)) + DECL_VINDEX (decl) = NULL_TREE; } else if (TREE_CODE (decl) == VAR_DECL) { diff --git a/gcc/tree.h b/gcc/tree.h index b50336190f9..053076f7f1c 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3229,7 +3229,7 @@ struct GTY(()) tree arguments; /* Almost all FE's use this. */ tree result; - /* C++ uses this in namespaces. */ + /* C++ uses this in namespaces and function_decls. */ tree vindex; }; -- 2.30.2