Bug 63693 - ICE in resolve_typename_type
Summary: ICE in resolve_typename_type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.2
: P3 normal
Target Milestone: 6.0
Assignee: Not yet assigned to anyone
URL:
Keywords: ice-on-invalid-code
: 70254 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-10-30 22:16 UTC by rippey.e
Modified: 2016-09-20 09:11 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2015-02-09 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rippey.e 2014-10-30 22:16:51 UTC
With gcc 4.9.2 or 4.9.1 running:

g++ --std=c++11 ch3.cpp

with the contents of ch3.cpp being:

"template<typename T>
class C{
 T t;
 decltype(t)::a::"

will produce:

ch3.cpp:4:2: internal compiler error: Segmentation fault
  decltype(t)::a::
  ^
0x91b6df crash_signal
        ../../gcc-4.9.2/gcc/toplev.c:337
0x532c2a resolve_typename_type(tree_node*, bool)
        ../../gcc-4.9.2/gcc/cp/pt.c:21479
0x576cb1 cp_parser_nested_name_specifier_opt
        ../../gcc-4.9.2/gcc/cp/parser.c:5186
0x574343 cp_parser_id_expression
        ../../gcc-4.9.2/gcc/cp/parser.c:4711
0x57454f cp_parser_parse_and_diagnose_invalid_type_name
        ../../gcc-4.9.2/gcc/cp/parser.c:3024
0x58fa44 cp_parser_member_declaration
        ../../gcc-4.9.2/gcc/cp/parser.c:20256
0x571460 cp_parser_member_specification_opt
        ../../gcc-4.9.2/gcc/cp/parser.c:20108
0x571460 cp_parser_class_specifier_1
        ../../gcc-4.9.2/gcc/cp/parser.c:19336
0x571460 cp_parser_class_specifier
        ../../gcc-4.9.2/gcc/cp/parser.c:19563
0x571460 cp_parser_type_specifier
        ../../gcc-4.9.2/gcc/cp/parser.c:14339
0x582a60 cp_parser_decl_specifier_seq
        ../../gcc-4.9.2/gcc/cp/parser.c:11575
0x58e2b3 cp_parser_single_declaration
        ../../gcc-4.9.2/gcc/cp/parser.c:23181
0x58e774 cp_parser_template_declaration_after_export
        ../../gcc-4.9.2/gcc/cp/parser.c:23050
0x592389 cp_parser_declaration
        ../../gcc-4.9.2/gcc/cp/parser.c:10975
0x590ef8 cp_parser_declaration_seq_opt
        ../../gcc-4.9.2/gcc/cp/parser.c:10897
0x5926fa cp_parser_translation_unit
        ../../gcc-4.9.2/gcc/cp/parser.c:4028
0x5926fa c_parse_file()
        ../../gcc-4.9.2/gcc/cp/parser.c:31701
0x63ab23 c_common_parse_file()
        ../../gcc-4.9.2/gcc/c-family/c-opts.c:1067
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
/disk/0/erippey/series2_we_qa/csrc/reduce>g++ --version
g++ (GCC) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Obviously this example is not valid C++.  It was arrived at by taking a much longer program which was believed to be valid C++ and removing parts without regard to validity.
Comment 1 Andrew Pinski 2015-02-09 19:00:30 UTC
Confirmed.; still ICEs as of today.
Comment 2 rippey.e 2015-08-07 17:48:23 UTC
Tried with gcc 5.2.0.  Same result (modulo line #'s, etc.)
Comment 3 Paolo Carlini 2015-08-13 15:17:29 UTC
Mine.
Comment 4 paolo@gcc.gnu.org 2015-08-22 17:45:18 UTC
Author: paolo
Date: Sat Aug 22 17:44:46 2015
New Revision: 227098

URL: https://gcc.gnu.org/viewcvs?rev=227098&root=gcc&view=rev
Log:
/cp
2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/63693
	* pt.c (resolve_typename_type): Use CLASSTYPE_PRIMARY_TEMPLATE_TYPE
	only on class types.

/testsuite
2015-08-22  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/63693
	* g++.dg/cpp0x/decltype63.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/decltype63.C
Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/pt.c
    trunk/gcc/testsuite/ChangeLog
Comment 5 Paolo Carlini 2015-08-22 18:35:50 UTC
Fixed.
Comment 6 Yury V. Zaytsev 2015-11-27 10:37:10 UTC
Just stumbled upon this ICE in my code on GCC 5.2.1:

$ cat ice.i
template<typename T>
void foo(T obj) {
    using local_type = decltype(obj)::element_type::other_type
}

Do I understand it correctly that this will only be fixed for GCC 6.x, and not for GCC 4.x/5.x?

Many thanks!
Comment 7 Paolo Carlini 2016-09-20 09:08:58 UTC
*** Bug 70254 has been marked as a duplicate of this bug. ***
Comment 8 Yury V. Zaytsev 2016-09-20 09:11:32 UTC
So, not going to be backported to 5.x?