Bug 45043 - [4.4/4.5 Regression] ICE: tree check: expected identifier_node, have bit_not_expr in grokdeclarator, at cp/decl.c:8113 on invalid code
Summary: [4.4/4.5 Regression] ICE: tree check: expected identifier_node, have bit_not_...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.6.0
: P5 minor
Target Milestone: 4.6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-checking, ice-on-invalid-code
Depends on:
Blocks:
 
Reported: 2010-07-23 14:15 UTC by Zdenek Sojka
Modified: 2011-06-09 16:25 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.2, 4.6.0
Known to fail: 4.4.5, 4.5.1
Last reconfirmed: 2010-07-24 20:38:56


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zdenek Sojka 2010-07-23 14:15:20 UTC
Command line:
$ g++ testcase.C

----- testcase.C -----
template < typename > class A;
template < typename T > A < T >::B::~B ()
{}
----------------------

Compiler output:
$ g++ testcase.C
testcase.C:2:25: error: 'A< <template-parameter-1-1> >::B' is not a type
testcase.C:2:41: internal compiler error: tree check: expected identifier_node, have bit_not_expr in grokdeclarator, at cp/decl.c:8113
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Tested revisions:
r162222 - crash
4.4 r149995 - crash
Comment 1 Andrew Pinski 2010-07-24 20:38:56 UTC
Confirmed. 4.3.2 works.
Comment 2 H.J. Lu 2010-07-24 23:02:46 UTC
It failed for me with gcc 4.2.0 and 4.3.0:

[hjl@gnu-26 rrs]$ cat pr45043.cc 
template < typename > class A;
template < typename T > A < T >::B::~B ()
{}
[hjl@gnu-26 rrs]$ /export/gnu/import/rrs/117167/usr/bin/gcc -S pr45043.cc
pr45043.cc:2: error: \u2018A< <template-parameter-1-1> >::B\u2019 is not a type
pr45043.cc:2: internal compiler error: tree check: expected identifier_node, have bit_not_expr in grokdeclarator, at cp/decl.c:7178
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-26 rrs]$ /export/gnu/import/rrs/117167/usr/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --prefix=/export/gnu/import/rrs/117167/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --enable-shared --enable-threads=posix --enable-haifa --enable-checking --enable-languages=c,c++,fortran --disable-bootstrap
Thread model: posix
gcc version 4.2.0 20060923 (experimental)
[hjl@gnu-26 rrs]$ /export/gnu/import/rrs/125623/usr/bin/gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../src/configure --prefix=/export/gnu/import/rrs/125623/usr --enable-clocale=gnu --with-system-zlib --with-demangler-in-ld --enable-shared --enable-threads=posix --enable-haifa --enable-checking --enable-languages=c,c++,fortran --disable-bootstrap
Thread model: posix
gcc version 4.3.0 20070611 (experimental)
[hjl@gnu-26 rrs]$ 
Comment 3 H.J. Lu 2010-07-24 23:03:18 UTC
[hjl@gnu-26 rrs]$ /export/gnu/import/rrs/125623/usr/bin/gcc -S pr45043.cc
pr45043.cc:2: error: \u2018A< <template-parameter-1-1> >::B\u2019 is not a type
pr45043.cc:2: internal compiler error: tree check: expected identifier_node, have bit_not_expr in grokdeclarator, at cp/decl.c:7365
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
[hjl@gnu-26 rrs]
Comment 4 Paolo Carlini 2010-08-30 16:29:01 UTC
Just checking that TREE_CODE (dname) == IDENTIFIER_NODE before using MAIN_NAME_P on it appears to fix the issue. 
Comment 5 paolo@gcc.gnu.org 2010-08-30 18:13:57 UTC
Subject: Bug 45043

Author: paolo
Date: Mon Aug 30 18:13:32 2010
New Revision: 163655

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=163655
Log:
/cp
2010-08-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/45043
	* decl.c (grokdeclarator): Use MAIN_NAME_P only on IDENTIFIER_NODEs.

/testsuite
2010-08-30  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/45043
	* g++.dg/template/crash102.C: New.

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

Comment 6 Paolo Carlini 2010-08-30 18:15:17 UTC
Fixed for 4.6.0.
Comment 7 Paolo Carlini 2011-06-09 16:25:59 UTC
Fixed.