Bug 9228 - [3.4 regression] [New parser] SegFault on illegal template
Summary: [3.4 regression] [New parser] SegFault on illegal template
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: 3.4.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-01-08 07:56 UTC by Wolfgang Bangerth
Modified: 2004-08-25 17:26 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Wolfgang Bangerth 2003-01-08 07:56:02 UTC
This is a new ICE on this little illegal piece of code:
--------------------------------
template <class T>
typename O<T>::I f () {}
--------------------------------
Since O is not a declared class, this should fail, and
indeed does with 3.3:
  deal.II/base> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c d.cc
  d.cc:2: error: parse error before `<' token

However, with 3.4 I now get
  deal.II/base> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c d.cc
  d.cc:2: internal compiler error: Segmentation fault
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

What's a little annoying is that the ICE happens before
any message is written, so it is not obvious right away
what's wrong.

Release:
unknown

Environment:
3.4 with new parser
Comment 1 Wolfgang Bangerth 2003-01-08 10:34:28 UTC
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu>
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: c++/9228: [3.4 regression] [New parser] SegFault on illegal
 template
Date: Wed, 8 Jan 2003 10:34:28 -0600 (CST)

 Possibly related:
 ------------------------
 struct O {
     struct I { I (int); };
 };
 
 template <class T_>
 typename O<T_>::I f () { return 1; };
 -------------------------
 
 deal.II/base> /home/bangerth/bin/gcc-3.3-pre/bin/c++ -c g.cc
 g.cc:6: error: non-template type `O' used as a template
 g.cc:6: error: `I' is not a class or namespace
 g.cc:6: error: ISO C++ forbids declaration of `f' with no type
 deal.II/base>
 deal.II/base>
 deal.II/base> /home/bangerth/bin/gcc-3.4-pre/bin/c++ -c g.cc
 g.cc:6: internal compiler error: Segmentation fault
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
 
 
 -------------------------------------------------------------------------
 Wolfgang Bangerth             email:            bangerth@ticam.utexas.edu
                               www: http://www.ticam.utexas.edu/~bangerth/
 
 
Comment 2 Volker Reichelt 2003-01-15 01:22:03 UTC
State-Changed-From-To: open->closed
State-Changed-Why: Fixed in gcc 3.4-20030113.
    I now get
    
    PR9228.cc:1: error: expected nested-name-specifier
    PR9228.cc:1: error: expected function-definition
    
    for both code snippets.
    
    (Testcase in preparation.)
Comment 3 Volker Reichelt 2003-02-06 22:34:55 UTC
From: reichelt@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c++/9228
Date: 6 Feb 2003 22:34:55 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	reichelt@gcc.gnu.org	2003-02-06 22:34:55
 
 Modified files:
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/parse: fused-params1.C 
 	                            tmpl-tmpl-operator1.C 
 	                            non-dependent1.C dupl-tmpl-args1.C 
 	                            undefined7.C non-templ1.C 
 	                            too-many-tmpl-args1.C 
 
 Log message:
 	PR c++/8785
 	* g++.dg/parse/fused-params1.C: New test.
 	
 	PR c++/8857
 	* g++.dg/parse/tmpl-tmpl-operator1.C: New test.
 	
 	PR c++/8921
 	* g++.dg/parse/non-dependent1.C: New test.
 	
 	PR c++/8928
 	* g++.dg/parse/dupl-tmpl-args1.C: New test.
 	
 	PR c++/9228
 	* g++.dg/parse/undefined7.C: New test.
 	* g++.dg/parse/non-templ1.C: New test.
 	
 	PR c++/9229
 	* g++.dg/parse/too-many-tmpl-args1.C: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2399&r2=1.2400
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/fused-params1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/tmpl-tmpl-operator1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/non-dependent1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/dupl-tmpl-args1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/undefined7.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/non-templ1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/parse/too-many-tmpl-args1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1