[Bug c++/85558] New: ICE in make_rtl_for_nonlocal_decl when using static member of template class
xaizek at posteo dot net
gcc-bugzilla@gcc.gnu.org
Sat Apr 28 10:42:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85558
Bug ID: 85558
Summary: ICE in make_rtl_for_nonlocal_decl when using static
member of template class
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: xaizek at posteo dot net
Target Milestone: ---
Source code to reproduce the ICE
================================
// no ICE if triggerBug is not a template
template <typename T>
struct triggerBug {
// no ICE if order of these two lines is swapped
friend void doInitUser(bool = triggerBug::doInit);
static bool doInit;
};
template <class T>
bool triggerBug<T>::doInit = true;
triggerBug<int> bug;
Command line and error message
==============================
$ g++-trunk gcc-bug.cpp -c -o /dev/null
gcc-bug.cpp: In instantiation of ‘struct triggerBug<int>’:
gcc-bug.cpp:12:17: required from here
gcc-bug.cpp:10:6: internal compiler error: in make_rtl_for_nonlocal_decl, at
cp/decl.c:6587
bool triggerBug<T>::doInit = true;
^~~~~~~~~~~~~
0x702c4a make_rtl_for_nonlocal_decl
../../gcc/cp/decl.c:6585
0x73211c cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
../../gcc/cp/decl.c:7243
0x8638f0 instantiate_class_template_1
../../gcc/cp/pt.c:11174
0x8638f0 instantiate_class_template(tree_node*)
../../gcc/cp/pt.c:11398
0x8be552 complete_type(tree_node*)
../../gcc/cp/typeck.c:136
0x7071e7 start_decl_1(tree_node*, bool)
../../gcc/cp/decl.c:5278
0x72ce17 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
../../gcc/cp/decl.c:5241
0x7ed93f cp_parser_init_declarator
../../gcc/cp/parser.c:19620
0x7ef8d9 cp_parser_simple_declaration
../../gcc/cp/parser.c:13063
0x7f07d8 cp_parser_block_declaration
../../gcc/cp/parser.c:12875
0x7fc394 cp_parser_declaration
../../gcc/cp/parser.c:12772
0x7fad96 cp_parser_declaration_seq_opt
../../gcc/cp/parser.c:12648
0x7fb0a3 cp_parser_translation_unit
../../gcc/cp/parser.c:4563
0x7fb0a3 c_parse_file()
../../gcc/cp/parser.c:39045
0x943bc5 c_common_parse_file()
../../gcc/c-family/c-opts.c:1132
Compiler version
================
Same results locally on 5.5.0, 7.3.0, trunk (git:
2e7e8f549a4c4c5885e4f7f5a4271f3610b54c3a, svn: 259739), and looks like any
version since 4.4 on compiler explorer (4.1 says `incomplete type
'triggerBug<int>' used in nested name specifier`). So I'm not providing
compiler flags or system details as this probably affects pretty much anything
in use today.
More information about the Gcc-bugs
mailing list