Bug 12369 - [3.3 Regression] ICE with templates and friends
Summary: [3.3 Regression] ICE with templates and friends
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 3.3.1
: P2 normal
Target Milestone: 3.3.2
Assignee: Kriang Lerdsuwanakij
Keywords: ice-on-valid-code, monitored
Depends on:
Reported: 2003-09-22 20:39 UTC by Jiangbin Zhao
Modified: 2003-10-17 12:07 UTC (History)
4 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2003-09-22 20:58:28


Note You need to log in before you can comment on or make changes to this bug.
Description Jiangbin Zhao 2003-09-22 20:39:13 UTC
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)
Comment 1 Wolfgang Bangerth 2003-09-22 20:58:27 UTC
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?

Comment 2 Andrew Pinski 2003-09-22 21:28:49 UTC
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>).
Comment 3 Kriang Lerdsuwanakij 2003-09-23 12:56:34 UTC
This the patch I fixed in the mainline


I'll check to see if 3.3 branch needs the same or different
Comment 4 Kriang Lerdsuwanakij 2003-09-25 12:23:40 UTC
Patch submitted:

Comment 5 andreasmeier80 2003-10-04 09:08:34 UTC
Patch submitted:

Comment 6 Mark Mitchell 2003-10-05 18:34:14 UTC
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.


Comment 8 Mark Mitchell 2003-10-16 09:34:39 UTC
Fixed in GCC 3.3.3.
Comment 9 andreasmeier80 2003-10-16 18:40:46 UTC
It may be useful to add the testcase to mainline
Comment 10 Mark Mitchell 2003-10-16 19:03:02 UTC
I'll let Kriang take care of that when he gets back from vacation.
Comment 11 CVS Commits 2003-10-17 11:14:58 UTC
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.


Comment 12 Kriang Lerdsuwanakij 2003-10-17 11:17:09 UTC
Done.  The testcase is committed to mainline.
Comment 13 Volker Reichelt 2003-10-17 12:07:15 UTC
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).