Internal compiler error in ropeimpl.h, 2.96
Jean-Francois Panisset
panisset@discreet.com
Tue Jun 6 20:29:00 GMT 2000
< 200006060719.JAA01306@loewis.home.cs.tu-berlin.de >"Martin v. Loewis" writes
>> time reducing the test case to a more manageable size. Unfortunately,
>> I have not been able to add it to the GNATS entry, so for what it's worth,
>> here is this reduced test case:
>
>Thanks, I've added it to the PR. Sending small examples is not
>mandatory, but highly appreciated. Since you already spend quite some
>time on this: Would you be interested in working on a fix yourself?
>
>Just run cc1plus in a debugger, and run the (simplified) file, passing
>-quiet as an option (i.e. r -quiet newfile.cc). That will quickly get
>you to the point where it crashes.
>
>Regards,
>Martin
I spent a couple of hours gdb-ing pt.c, but I have to admit that
I'm in over my head. I did manage to get what I believe to be the
minimal test case:
template<class T>
struct base
{
void mf();
};
template<class T>
struct derived : public base<T>
{
~derived()
{
mf();
}
};
template <class T>
void base<T>::mf()
{
((derived<T>*)this)->derived<T>::~derived();
}
derived<char> bar;
For what it's worth, here is a stack trace at the point at which
the compiler segfaults:
Program received signal SIGSEGV, Segmentation fault.
0x8201f0f in tsubst_decl (t=0x4012a880, args=0x40129d00, type=0x4012a900,
in_decl=0x4011eb00) at ../../../gcc/cp/pt.c:5943
5943 tmpl = DECL_TI_TEMPLATE (t);
(gdb) where
#0 0x8201f0f in tsubst_decl (t=0x4012a880, args=0x40129d00, type=0x4012a900,
in_decl=0x4011eb00) at ../../../gcc/cp/pt.c:5943
#1 0x82034d1 in tsubst_copy (t=0x401298e0, args=0x40129d00, complain=1,
in_decl=0x4011eb00) at ../../../gcc/cp/pt.c:6981
#2 0x8204017 in tsubst_expr (t=0x401298e0, args=0x40129d00, complain=1,
in_decl=0x4011eb00) at ../../../gcc/cp/pt.c:7427
#3 0x8203a4e in tsubst_expr (t=0x40129900, args=0x40129d00, complain=1,
in_decl=0x4011eb00) at ../../../gcc/cp/pt.c:7185
#4 0x8203cdb in tsubst_expr (t=0x40129300, args=0x40129d00, complain=1,
in_decl=0x4011eb00) at ../../../gcc/cp/pt.c:7297
#5 0x82063b0 in instantiate_decl (d=0x4012ad80, defer_ok=0)
at ../../../gcc/cp/pt.c:9715
#6 0x82064d2 in instantiate_pending_templates () at ../../../gcc/cp/pt.c:9794
#7 0x82139bc in finish_file () at ../../../gcc/cp/decl2.c:3583
#8 0x82261f1 in yyparse () at parse.y:434
#9 0x804b6ae in compile_file (name=0x40123400 "ropecrash4.C")
at ../../gcc/toplev.c:2288
#10 0x804e81e in main (argc=4, argv=0xbffff9d4) at ../../gcc/toplev.c:4702
The lines in question are:
5940 /* Check to see if we already have this specialization. */
5941 if (!local_p)
5942 {
5943 tmpl = DECL_TI_TEMPLATE (t);
5944 gen_tmpl = most_general_template (tmpl);
5945 argvec = tsubst (DECL_TI_ARGS (t), args, /*complain=*/1, in_decl);
5946 spec = retrieve_specialization (gen_tmpl, argvec);
5947 }
5948 else
5949 spec = retrieve_local_specialization (t);
And the problem is that:
#define DECL_TI_TEMPLATE(NODE) TI_TEMPLATE (DECL_TEMPLATE_INFO (NODE))
#define DECL_TEMPLATE_INFO(NODE) \
(DECL_LANG_SPECIFIC(VAR_TEMPL_TYPE_OR_FUNCTION_DECL_CHECK (NODE))->decl_flags.u.template_info)
#define DECL_LANG_SPECIFIC(NODE) (DECL_CHECK (NODE)->decl.lang_specific)
(gdb) p t->decl.lang_specific
$30 = (struct lang_decl *) 0x0
i.e. a nil pointer is being dereferenced. Unfortunately, it looks like
gcc internals is not something you can just "pick up" in a couple
of hours of running the debugger :-(
Thanks!
JF
Jean-Francois Panisset panisset@discreet.com
Software Engineer
Discreet Logic
More information about the Gcc-bugs
mailing list