Bug 39225 - [4.3 Regression] ICE if destructor doen't match class name
Summary: [4.3 Regression] ICE if destructor doen't match class name
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.3.4
Assignee: Jason Merrill
URL:
Keywords: ice-checking, ice-on-invalid-code
: 40284 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-02-18 07:54 UTC by Christian Engwer
Modified: 2009-05-29 07:50 UTC (History)
3 users (show)

See Also:
Host: i386-pc-linux-gnu
Target: i386-pc-linux-gnu
Build: i386-pc-linux-gnu
Known to work: 4.3.2 4.4.0
Known to fail: 4.3.4
Last reconfirmed: 2009-02-18 21:24:06


Attachments
example to trigger the bug (100 bytes, text/x-c++src)
2009-02-18 07:55 UTC, Christian Engwer
Details
preprocessed test.cc (141 bytes, text/plain)
2009-02-18 11:10 UTC, Christian Engwer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Engwer 2009-02-18 07:54:15 UTC
If the constructor of a class does not match the class name, the compiler dies with a segfault.

I'll attach an example program.
running 

> g++ test.cc
test.cc:6: internal compiler error: Segmentation fault

will already trigger the bug.

The source code is not valid code, but with previous versions (e.g. 4.2) I got a meaningful error message:

> g++-4.2 test.cc 
test.cc:6: error: expected class-name before ‘(’ token

Cheers
  Christian
Comment 1 Christian Engwer 2009-02-18 07:55:05 UTC
Created attachment 17319 [details]
example to trigger the bug
Comment 2 Richard Biener 2009-02-18 10:11:55 UTC
It works for me with the release-checking built 4.3.3 release (as well as
4.3.0, 4.3.1 and 4.3.2).  With the branch r143959 and checking enabled it gives

test.cc:6: internal compiler error: tree check: expected class ‘type’, have ‘exceptional’ (identifier_node) in constructor_name_full, at cp/name-lookup.c:1715
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

so I'm not sure if this is a regression.
Comment 3 Christian Engwer 2009-02-18 11:10:21 UTC
Created attachment 17324 [details]
preprocessed test.cc
Comment 4 Andrew Pinski 2009-02-18 18:46:12 UTC
It works for me with:
GNU C++ (GCC) version 4.4.0 20081229 (experimental) [trunk revision 142951] (i386-apple-darwin8.11.1)
        compiled by GNU C version 4.4.0 20081229 (experimental) [trunk revision 142951], GMP version 4.2.2, MPFR version 2.3.0.

Comment 5 Andrew Pinski 2009-02-18 18:46:56 UTC
And:
GNU C++ (GCC) version 4.4.0 20090116 (experimental) [trunk revision 143448] (powerpc64-unknown-linux-gnu)
        compiled by GNU C version 4.4.0 20090116 (experimental) [trunk revision 143448], GMP version 4.2.2, MPFR version 2.3.1.

Comment 6 Andrew Pinski 2009-02-18 18:47:54 UTC
And in the release of 4.3.2 with checking turned on.
Comment 7 H.J. Lu 2009-02-18 20:19:20 UTC
It is caused by revision 143502 on trunk:

http://gcc.gnu.org/ml/gcc-cvs/2009-01/msg00515.html
Comment 8 Jason Merrill 2009-02-20 05:32:54 UTC
Subject: Bug 39225

Author: jason
Date: Fri Feb 20 05:32:40 2009
New Revision: 144314

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144314
Log:
        PR c++/39225
        * decl.c (grokdeclarator): Handle ~identifier.

Added:
    trunk/gcc/testsuite/g++.dg/parse/dtor15.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 9 Jason Merrill 2009-02-20 05:33:18 UTC
Fixed.
Comment 10 H.J. Lu 2009-02-20 05:37:05 UTC
I think 4.3 branch is still broken.
Comment 11 Jason Merrill 2009-02-20 15:22:09 UTC
Subject: Bug 39225

Author: jason
Date: Fri Feb 20 15:21:51 2009
New Revision: 144325

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=144325
Log:
        PR c++/39225
        * decl.c (grokdeclarator): Handle ~identifier.

Added:
    branches/gcc-4_3-branch/gcc/testsuite/g++.dg/parse/dtor15.C
      - copied unchanged from r144314, trunk/gcc/testsuite/g++.dg/parse/dtor15.C
Modified:
    branches/gcc-4_3-branch/gcc/cp/ChangeLog
    branches/gcc-4_3-branch/gcc/cp/decl.c
    branches/gcc-4_3-branch/gcc/testsuite/ChangeLog

Comment 12 Jason Merrill 2009-02-20 18:59:00 UTC
Fixed in 4.3 as well.
Comment 13 Richard Biener 2009-05-29 07:50:06 UTC
*** Bug 40284 has been marked as a duplicate of this bug. ***