This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14108] [3.4/3.5 regression] ICE on simple testcase
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Feb 2004 19:02:00 -0000
- Subject: [Bug c++/14108] [3.4/3.5 regression] ICE on simple testcase
- References: <20040211121610.14108.altacsd@yahoo.fr>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2004-02-13 19:01 -------
The problem is that the THUNK_TARGET macro and DECL_BEFRIENDING_CLASSES macro
reference the same field in the nested structure. Now the former is set to the
thunked-to function in make_thunk by
THUNK_TARGET (thunk) = function;
so ends up holding a DECL, while the latter expects a TREE_LIST.
There seems to be a contradiction in cp-tree.h between
struct full_lang_decl
{
/* For a non-thunk function decl, this is a tree list of
friendly classes. For a thunk function decl, it is the
thunked to function decl. */
tree befriending_classes;
and
A thunk is an alternate entry point for an ordinary FUNCTION_DECL.
The address of the ordinary FUNCTION_DECL is given by the
DECL_INITIAL, which is always an ADDR_EXPR whose operand is a
FUNCTION_DECL.
The following ad-hoc patch fixes the ICE:
Index: search.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/search.c,v
retrieving revision 1.284
diff -u -p -r1.284 search.c
--- search.c 19 Dec 2003 23:28:10 -0000 1.284
+++ search.c 13 Feb 2004 19:00:39 -0000
@@ -856,7 +856,7 @@ friend_accessible_p (tree scope, tree de
if (!scope)
return 0;
- if (TREE_CODE (scope) == FUNCTION_DECL
+ if ((TREE_CODE (scope) == FUNCTION_DECL && !DECL_THUNK_P (scope))
|| DECL_FUNCTION_TEMPLATE_P (scope))
befriending_classes = DECL_BEFRIENDING_CLASSES (scope);
else if (TYPE_P (scope))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14108