[forwarded from http://bugs.debian.org/261051] seen with 3.4.1 and HEAD 20040717, configured with --enable-libstdc++-allocator=mt. ok with 3.3.4 (configured with standard allocator). Not yet checked with the default configuration in 3.4 and HEAD. Matthias $ gcc-3.4 -c oggfile.ii /usr/include/c++/3.4/ext/mt_allocator.h: In instantiation of `__gnu_cxx::__mt_alloc<_Tp>': /usr/include/c++/3.4/bits/allocator.h:81: instantiated from `std::allocator<_CharT>' /usr/include/c++/3.4/bits/stl_list.h:295: instantiated from `std::_List_base<T, std::allocator<_CharT> >' /usr/include/c++/3.4/bits/stl_list.h:388: instantiated from `std::list<T, std::allocator<_CharT> >' /src/kde/kdesupport/taglib/toolkit/tlist.h:53: instantiated from `TagLib::List<T>' /src/kde/kdesupport/taglib/toolkit/tlist.tcc:67: instantiated from `TagLib::List<T>::ListPrivate<TP*>::ListPrivate() [with TP = TagLib::Ogg::Page, T = TagLib::Ogg::Page*]' /src/kde/kdesupport/taglib/toolkit/tlist.tcc:90: instantiated from `TagLib::List<T>::List() [with T = TagLib::Ogg::Page*]' /src/kde/kdesupport/taglib/ogg/oggfile.cpp:42: instantiated from here /usr/include/c++/3.4/ext/mt_allocator.h:120: internal compiler error: in finish_member_declaration, at cp/semantics.c:2101 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Created attachment 6826 [details] preprocessed source
Confirmed but I have not reduced it yet. Even though the mt allocator sources is included and this might not show up with the standard allocated, this is a bug in the C++ front-end and not libstdc++ and still can be reproduced using the preprocessed source.
I can't seem to get it smaller than this: ------------------------ template <typename> struct B { B() throw() {} struct S { }; static int i; typedef unsigned short int dummy; }; template <typename _Tp> struct allocator: B<_Tp> { template<typename _Tp1> struct rebind { typedef allocator<_Tp1> other; }; }; template<typename T, typename> struct X { typename allocator<T>::template rebind<int>::other i; typedef int* dummy; }; template <class T> class A { typedef typename X<T,allocator<T> >::dummy dummy; template <class TP> class XWrapper; }; template <class T> template <class TP> struct A<T>::XWrapper<TP *> { XWrapper() {} X<int,allocator<int> > x; }; template class A<int>::XWrapper<int *>; --------------------------------- This crashes both 3.4.x and mainline, but not 3.3.x: x/gg> /home/bangerth/bin/gcc-3.3*/bin/c++ -c x.cc x/gg> /home/bangerth/bin/gcc-3.4*/bin/c++ -c x.cc x.cc: In instantiation of `allocator<T>::rebind<int>': x.cc:16: instantiated from `X<T, allocator<T> >' x.cc:21: instantiated from `A<T>' x.cc:29: instantiated from `A<T>::XWrapper<TP*>::XWrapper() [with TP = int, T = int]' x.cc:33: instantiated from here x.cc:11: internal compiler error: in instantiate_class_template, at cp/pt.c:5404 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. x/gg> /home/bangerth/bin/gcc-3.5*/bin/c++ -c x.cc x.cc: In instantiation of `allocator<T>::rebind<int>': x.cc:16: instantiated from `X<T, allocator<T> >' x.cc:21: instantiated from `A<T>' x.cc:29: instantiated from `A<T>::XWrapper<TP*>::XWrapper() [with TP = int, T = int]' x.cc:33: instantiated from here x.cc:11: internal compiler error: in instantiate_class_template, at cp/pt.c:5440 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. W.
Here's something slightly smaller: =============================================================== template<typename> struct A { A(); template<typename> struct X {}; }; template<typename T> struct B { typename A<T>::template X<int> x; template<typename> struct C; }; template<typename T> template<typename U> struct B<T>::C<U*> { C() {} A<int> a; }; template struct B<int>::C<int*>; =============================================================== Note that the ICE in Wolfgang's and this example happens in a different place than the original example.
Volker's reduced code : Search converges between 2003-01-15-trunk (#165) and 2003-01-17-trunk (#166). Wolfgang's reduced code : Search converges between 2003-10-17-trunk (#379) and 2003-10-18-trunk (#380). So they look like two different bugs.
Andrew: I get an ICE in exactly the same position for both Volker's and my testcase. Are you sure they started at different times? Or did you mean that you compared one of our testcases with the original one? W.
Look like something I broke. I think a call to dependent_type_p is missing somewhere.
> Volker's reduced code > : Search converges between 2003-01-15-trunk (#165) and 2003-01-17-trunk (#166). > > Wolfgang's reduced code > : Search converges between 2003-10-17-trunk (#379) and 2003-10-18-trunk (#380). > > So they look like two different bugs. I still think this is the same underlying bug: a) I reduced Wolfgang's version to come up with mine. b) My example starts with an ICE in cxx_incomplete_type_diagnostic, at cp/typeck2.c:278 which changed to instantiate_class_template, at cp/pt.c:5440 the day Wolfgang's testcase started crashing the compiler. Btw, I've got another reduced example - this time the crash is in the same spot as with the original example. For this one I also get : Search converges between 2003-01-15-trunk (#165) and 2003-01-17-trunk (#166). =============================================================================== template<typename> struct A { struct X; struct Y; }; template<typename T> struct B { T t; B(); }; template<typename T> struct C { B<A<T> > b; template<typename> struct D; }; template<typename T> template<typename U> struct C<T>::D<U*> { B<A<T> > b; D() {} }; template struct C<int>::D<int*>; ===============================================================================
Kriang, thanks for taking the blame, but I think you're innocent in this case. The trouble starts with Mark's patch http://gcc.gnu.org/ml/gcc-cvs/2003-01/msg00660.html
Patch submitted: http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00151.html
(In reply to comment #10) > Patch submitted: > > http://gcc.gnu.org/ml/gcc-patches/2004-08/msg00151.html is it already applied?
No, it's still waiting for approval.
This patch is OK, please apply.
Subject: Bug 16706 CVSROOT: /cvs/gcc Module name: gcc Changes by: lerdsuwa@gcc.gnu.org 2004-08-24 14:13:50 Modified files: gcc/cp : ChangeLog search.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: crash21.C crash22.C Log message: PR c++/16706 * search.c (friend_accessible_p): Increment processing_template_decl when deal with TEMPLATE_DECL of SCOPE. * g++.dg/template/crash21.C: New test. * g++.dg/template/crash22.C: Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4298&r2=1.4299 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&r1=1.309&r2=1.310 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4180&r2=1.4181 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash21.C.diff?cvsroot=gcc&r1=NONE&r2=1.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash22.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 16706 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: lerdsuwa@gcc.gnu.org 2004-08-24 14:32:25 Modified files: gcc/cp : ChangeLog search.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: crash21.C crash22.C Log message: PR c++/16706 * search.c (friend_accessible_p): Increment processing_template_decl when deal with TEMPLATE_DECL of SCOPE. * g++.dg/template/crash21.C: New test. * g++.dg/template/crash22.C: Likewise. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.150&r2=1.3892.2.151 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/search.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.284.4.2&r2=1.284.4.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.257&r2=1.3389.2.258 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash21.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/crash22.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed in the mainline and 3.4 branch.
Fixed.