This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix to c++/9336 introduces segfault
- From: Michael Matz <matz at suse dot de>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 13 Mar 2003 18:06:29 +0100 (CET)
- Subject: Fix to c++/9336 introduces segfault
Hi Mark,
me again ;) The patch
PR c++/9336
* decl2.c (do_nonmember_using_decl): Do not call duplicate decls
to merge old and new declarations.
introduces a segfault with the below snippet. If tree-checking is active,
it results in a check failure, namely:
bla.cc:7: internal compiler error: tree check: expected tree_list,
have type_decl in compparms, at cp/typeck.c:1418
, which is at:
1418 if (!same_type_p (TREE_VALUE (t2), TREE_VALUE (t1)))
The segfault acutally happens inside same_type_p(). The underlying
reason, I believe is, that compparms() is called with a function and a
record type, because do_nonmember_using_decl() does call it so, although
it's parameters look like:
4245 else if (compparms (TYPE_ARG_TYPES (TREE_TYPE (new_fn)),
4246 TYPE_ARG_TYPES (TREE_TYPE (old_fn))))
% p debug_tree(new_fn)
<function_decl 0x401960d8 f
type <function_type 0x4015f0d8
type <void_type 0x40159b64 void VOID
...
% p debug_tree(old_fn)
<type_decl 0x401965e8 f
type <record_type 0x401964a4 f type_1 type_5 QI
size <integer_cst 0x4014ed00 constant 8>
...
The snippet showing this is:
-------- snip ---------
namespace A {
void f();
}
int g()
{
struct f { };
using A::f;
}
-------- snap ---------
This happens on 3.3 branch and HEAD.
Ciao,
Michael.