public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/19143] New: [4.0 regression] ICE on invalid template parameter
@ 2004-12-24  1:39 reichelt at gcc dot gnu dot org
  2004-12-24  2:16 ` [Bug c++/19143] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-12-24  1:39 UTC (permalink / raw)
  To: gcc-bugs

The following invalid code snippet triggers an ICE on mainline:

==============================================
template<int> struct A;
template<> struct A<template> {};
==============================================

bug.cc:2: error: missing '>' to terminate the template argument list
bug.cc:2: error: template argument 1 is invalid
bug.cc:2: error: missing '>' to terminate the template argument list
bug.cc:2: error: template argument 1 is invalid
bug.cc:2: error: 'A' is not a template
bug.cc:2: error: missing '>' to terminate the template argument list
bug.cc:2: internal compiler error: Segmentation fault
Please submit a full bug report, [etc.]

Alexandre, this was causes by your path for PR18757:
http://gcc.gnu.org/ml/gcc-cvs/2004-12/msg00382.html

Could you please have a look?

-- 
           Summary: [4.0 regression] ICE on invalid template parameter
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Keywords: ice-on-invalid-code, error-recovery, monitored
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: reichelt at gcc dot gnu dot org
                CC: aoliva at gcc dot gnu dot org,gcc-bugs at gcc dot gnu
                    dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19143


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19143] [4.0 regression] ICE on invalid template parameter
  2004-12-24  1:39 [Bug c++/19143] New: [4.0 regression] ICE on invalid template parameter reichelt at gcc dot gnu dot org
@ 2004-12-24  2:16 ` pinskia at gcc dot gnu dot org
  2004-12-29  8:05 ` aoliva at redhat dot com
  2005-01-29  2:03 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-12-24  2:16 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-12-24 02:16 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
      Known to fail|                            |4.0.0
      Known to work|                            |3.4.0
   Last reconfirmed|0000-00-00 00:00:00         |2004-12-24 02:16:17
               date|                            |
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19143


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19143] [4.0 regression] ICE on invalid template parameter
  2004-12-24  1:39 [Bug c++/19143] New: [4.0 regression] ICE on invalid template parameter reichelt at gcc dot gnu dot org
  2004-12-24  2:16 ` [Bug c++/19143] " pinskia at gcc dot gnu dot org
@ 2004-12-29  8:05 ` aoliva at redhat dot com
  2005-01-29  2:03 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: aoliva at redhat dot com @ 2004-12-29  8:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From aoliva at redhat dot com  2004-12-29 08:04 -------
Subject: Re:  New: [4.0 regression] ICE on invalid template parameter

On Dec 23, 2004, "reichelt at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> wrote:

> The following invalid code snippet triggers an ICE on mainline:
> ==============================================
> template<int> struct A;
> template<> struct A<template> {};
> ==============================================

> bug.cc:2: error: missing '>' to terminate the template argument list
> bug.cc:2: error: template argument 1 is invalid
> bug.cc:2: error: missing '>' to terminate the template argument list
> bug.cc:2: error: template argument 1 is invalid
> bug.cc:2: error: 'A' is not a template
> bug.cc:2: error: missing '>' to terminate the template argument list
> bug.cc:2: internal compiler error: Segmentation fault
> Please submit a full bug report, [etc.]

> Alexandre, this was causes by your path for PR18757:
> http://gcc.gnu.org/ml/gcc-cvs/2004-12/msg00382.html

> Could you please have a look?

This patch fixes it, but I'm not entirely sure this is the best
location for this test.  Tested on amd64-linux-gnu, no failures.  Ok
to install?

Index: gcc/cp/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* pt.c (redeclare_class_template): Don't crash when parms
	parsing failed.

Index: gcc/cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.962
diff -u -p -r1.962 pt.c
--- gcc/cp/pt.c 23 Dec 2004 19:54:08 -0000 1.962
+++ gcc/cp/pt.c 29 Dec 2004 07:32:11 -0000
@@ -3234,6 +3234,11 @@ redeclare_class_template (tree type, tre
        type.  */
     return;
 
+  /* If the template parameters could not be parsed, assume we already
+     issued an error and bail out without crashing.  */
+  if (! parms)
+    return;
+
   parms = INNERMOST_TEMPLATE_PARMS (parms);
   tmpl_parms = DECL_INNERMOST_TEMPLATE_PARMS (tmpl);
 

-- 
Alexandre Oliva             http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19143


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c++/19143] [4.0 regression] ICE on invalid template parameter
  2004-12-24  1:39 [Bug c++/19143] New: [4.0 regression] ICE on invalid template parameter reichelt at gcc dot gnu dot org
  2004-12-24  2:16 ` [Bug c++/19143] " pinskia at gcc dot gnu dot org
  2004-12-29  8:05 ` aoliva at redhat dot com
@ 2005-01-29  2:03 ` mmitchel at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2005-01-29  2:03 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2005-01-29 02:03 -------


*** This bug has been marked as a duplicate of 19667 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19143


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-01-29  2:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-24  1:39 [Bug c++/19143] New: [4.0 regression] ICE on invalid template parameter reichelt at gcc dot gnu dot org
2004-12-24  2:16 ` [Bug c++/19143] " pinskia at gcc dot gnu dot org
2004-12-29  8:05 ` aoliva at redhat dot com
2005-01-29  2:03 ` mmitchel at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).