The following code causes ICE and Segmentation fault on line (1): struct A { template<class T> T* make() { return new T(); } }; struct B { friend B* A::make< B >(); // (1) }; Compilation command line: g++ -o ice.o ice.cc Output of g++ -v: Reading specs from /usr/lib/gcc-lib/i386-linux/3.3.1/specs Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --enable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i386-linux Thread model: posix gcc version 3.3.1 (Debian)
Confirmed, this is a regression on the 3.3 branch against 3.2 that compiled this fine. Mainline is fine as well. Here's what I get with 3.3 compiled with checking enabled: g/x> /home/bangerth/bin/gcc-3.3*/bin/c++ -c x.cc x.cc:6: internal compiler error: tree check: expected identifier_node, have template_id_expr in grokfndecl, at cp/decl.c:9594 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. Kriang, you have done all that great work in this area lately -- is this something that you think is possible to fix on the release branch? W.
From Phil's regression hunter (when it was fixed on the mainline): Search converges between 2003-07-15-trunk (#344) and 2003-07-16-trunk (#345). (MIght have been fixed by <http://gcc.gnu.org/ml/gcc-patches/2003-07/msg00993.html>).
This the patch I fixed in the mainline http://gcc.gnu.org/ml/gcc-patches/2003-07/msg01682.html I'll check to see if 3.3 branch needs the same or different fix.
Patch submitted: http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01673.html
Subject: Re: [3.3 Regression] ICE with templates and friends On Sat, 2003-10-04 at 02:08, andreas dot meier_ at gmx dot de wrote: > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12369 This patch is OK for 3.3. Thanks,
Subject: Bug 12369 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-10-16 09:34:00 Modified files: gcc : tree.h gcc/cp : ChangeLog decl.c friend.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: friend25.C Log message: PR c++/12369 * g++.dg/template/friend25.C: New test. PR c++/7939 * g++.dg/template/crash11.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.367.2.6&r2=1.367.2.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.216&r2=1.3076.2.217 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.965.2.63&r2=1.965.2.64 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/friend.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.77.4.2&r2=1.77.4.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.307&r2=1.2261.2.308 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend25.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Fixed in GCC 3.3.3.
It may be useful to add the testcase to mainline
I'll let Kriang take care of that when he gets back from vacation.
Subject: Bug 12369 CVSROOT: /cvs/gcc Module name: gcc Changes by: lerdsuwa@gcc.gnu.org 2003-10-17 11:14:55 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: friend25.C Log message: PR c++/12369 * g++.dg/template/friend25.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3127&r2=1.3128 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/friend25.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
Done. The testcase is committed to mainline.
Just a remark: It's already fixed in GCC 3.3.2 (and not only in 3.3.3 as Mark wrote in comment 8).