public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration
@ 2004-11-24 17:23 reichelt at gcc dot gnu dot org
  2004-11-24 18:05 ` [Bug c++/18652] " pinskia at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-24 17:23 UTC (permalink / raw)
  To: gcc-bugs

Mainline crashes on the following invalid code snippet:

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

bug.cc:6: error: 'template<int <anonymous> > struct A' redeclared as different
kind of symbol
bug.cc:5: error: previous declaration of 'int A'
bug.cc:6: internal compiler error: tree check: expected class 'declaration',
have 'exceptional' (error_mark) in push_template_decl_real, at cp/pt.c:3152
Please submit a full bug report, [etc.]

The release branches are not affected.

According to Phils's regression hunter the regression was introduced in
February:
: Search converges between 2004-02-01-trunk (#445) and 2004-03-01-trunk (#446).

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


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


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

* [Bug c++/18652] [4.0 regression] ICE on invalid redeclaration
  2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
@ 2004-11-24 18:05 ` pinskia at gcc dot gnu dot org
  2004-11-24 23:18 ` reichelt at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-24 18:05 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-24 18:05 -------
Confirmed.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-11-24 18:05:11
               date|                            |
   Target Milestone|---                         |4.0.0


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


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

* [Bug c++/18652] [4.0 regression] ICE on invalid redeclaration
  2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
  2004-11-24 18:05 ` [Bug c++/18652] " pinskia at gcc dot gnu dot org
@ 2004-11-24 23:18 ` reichelt at gcc dot gnu dot org
  2004-11-26 16:55 ` lerdsuwa at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: reichelt at gcc dot gnu dot org @ 2004-11-24 23:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From reichelt at gcc dot gnu dot org  2004-11-24 23:18 -------
IMHO duplicate_decls and/or its callers are broken.
The comment on top of duplicate_decls reads:

  /* If NEWDECL is a redeclaration of OLDDECL, merge the declarations.
     If the redeclaration is invalid, a diagnostic is issued, and the
     error_mark_node is returned.  Otherwise, OLDDECL is returned.

     If NEWDECL is not a redeclaration of OLDDECL, NULL_TREE is
     returned.  */

  tree
  duplicate_decls (tree newdecl, tree olddecl)

But in many situations we return a NULL_TREE, if an error occurred. In fact
we only return an error_mark_node twice. In the first case this leads to
the ICE:

  error ("%q#D redeclared as different kind of symbol", newdecl);
  if (TREE_CODE (olddecl) == TREE_LIST)
    olddecl = TREE_VALUE (olddecl);
  cp_error_at ("previous declaration of %q#D", olddecl);

  return error_mark_node;

Changing the error_mark_node into NULL_TREE in fact makes the ICE go away.
However, that causes a minor regression in the testsuite:

  FAIL: g++.dg/other/error8.C duplicate error messages (test for bogus messages,
line 8)
  FAIL: g++.dg/other/error8.C duplicate error messages (test for bogus messages,
line 9)

Looks like the right fix is to make duplicate_decls behave like the comment
says and teach the callers how to handle error_mark_node.
Maybe this even fixes the triple error message in PR18625.


-- 


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


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

* [Bug c++/18652] [4.0 regression] ICE on invalid redeclaration
  2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
  2004-11-24 18:05 ` [Bug c++/18652] " pinskia at gcc dot gnu dot org
  2004-11-24 23:18 ` reichelt at gcc dot gnu dot org
@ 2004-11-26 16:55 ` lerdsuwa at gcc dot gnu dot org
  2004-11-26 17:00 ` lerdsuwa at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-26 16:55 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |lerdsuwa at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/18652] [4.0 regression] ICE on invalid redeclaration
  2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
                   ` (2 preceding siblings ...)
  2004-11-26 16:55 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-26 17:00 ` lerdsuwa at gcc dot gnu dot org
  2004-11-27 15:43 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-26 17:00 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-26 17:00 -------
Will take a look, maybe it's fixed already by Mark.

-- 


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


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

* [Bug c++/18652] [4.0 regression] ICE on invalid redeclaration
  2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
                   ` (3 preceding siblings ...)
  2004-11-26 17:00 ` lerdsuwa at gcc dot gnu dot org
@ 2004-11-27 15:43 ` pinskia at gcc dot gnu dot org
  2004-11-29 14:18 ` cvs-commit at gcc dot gnu dot org
  2004-11-29 14:19 ` lerdsuwa at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-27 15:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-27 15:43 -------
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02377.html>.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


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


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

* [Bug c++/18652] [4.0 regression] ICE on invalid redeclaration
  2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
                   ` (4 preceding siblings ...)
  2004-11-27 15:43 ` pinskia at gcc dot gnu dot org
@ 2004-11-29 14:18 ` cvs-commit at gcc dot gnu dot org
  2004-11-29 14:19 ` lerdsuwa at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-11-29 14:18 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-11-29 14:18 -------
Subject: Bug 18652

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	lerdsuwa@gcc.gnu.org	2004-11-29 14:17:35

Modified files:
	gcc/cp         : cp-tree.h decl.c name-lookup.c pt.c ChangeLog 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/lookup: crash6.C 

Log message:
	PR c++/18652
	* name-lookup.c (pushtag): Change return type to tree.
	* cp-tree.h (pushtag): Adjust declaration.
	* decl.c (xref_tag, start_enum): Use return value of pushtag.
	* pt.c (push_template_decl_real): Return immediately if
	pushdecl_namespace_level returns error_mark_node.
	
	* g++.dg/lookup/crash6.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.1075&r2=1.1076
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&r1=1.1335&r2=1.1336
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/name-lookup.c.diff?cvsroot=gcc&r1=1.97&r2=1.98
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/pt.c.diff?cvsroot=gcc&r1=1.950&r2=1.951
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4502&r2=1.4503
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/lookup/crash6.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.4675&r2=1.4676



-- 


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


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

* [Bug c++/18652] [4.0 regression] ICE on invalid redeclaration
  2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
                   ` (5 preceding siblings ...)
  2004-11-29 14:18 ` cvs-commit at gcc dot gnu dot org
@ 2004-11-29 14:19 ` lerdsuwa at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: lerdsuwa at gcc dot gnu dot org @ 2004-11-29 14:19 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From lerdsuwa at gcc dot gnu dot org  2004-11-29 14:19 -------
Fixed in the mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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


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

end of thread, other threads:[~2004-11-29 14:19 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-24 17:23 [Bug c++/18652] New: [4.0 regression] ICE on invalid redeclaration reichelt at gcc dot gnu dot org
2004-11-24 18:05 ` [Bug c++/18652] " pinskia at gcc dot gnu dot org
2004-11-24 23:18 ` reichelt at gcc dot gnu dot org
2004-11-26 16:55 ` lerdsuwa at gcc dot gnu dot org
2004-11-26 17:00 ` lerdsuwa at gcc dot gnu dot org
2004-11-27 15:43 ` pinskia at gcc dot gnu dot org
2004-11-29 14:18 ` cvs-commit at gcc dot gnu dot org
2004-11-29 14:19 ` lerdsuwa 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).