https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71739
Bug ID: 71739
Summary: ICE on valid C++11 code: tree check: expected
identifier_node, have tree_list in
private_is_attribute_p, at tree.c:6080
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: su at cs dot ucdavis.edu
Target Milestone: ---
The following C++11 code causes an ICE when compiled with the current GCC trunk
on x86_64-linux-gnu in both 32-bit and 64-bit modes.
It is a regression from 6.1.x.
$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto
--prefix=/usr/local/gcc-trunk --disable-bootstrap
Thread model: posix
gcc version 7.0.0 20160702 (experimental) [trunk revision 237945] (GCC)
$
$ g++-6.1 -c small.cpp
$ clang++-3.8 -c -std=c++11 small.cpp
$
$ g++-trunk -c small.cpp
small.cpp:2:38: internal compiler error: tree check: expected identifier_node,
have tree_list in private_is_attribute_p, at tree.c:6080
template < int N > struct alignas(N) A {};
^
0x105eccc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
../../gcc-source-trunk/gcc/tree.c:9751
0x105f074 tree_check
../../gcc-source-trunk/gcc/tree.h:3286
0x105f074 private_is_attribute_p(char const*, unsigned long, tree_node const*)
../../gcc-source-trunk/gcc/tree.c:6080
0x1075cc2 is_attribute_p
../../gcc-source-trunk/gcc/tree.h:4164
0x1075cc2 attribute_value_equal(tree_node const*, tree_node const*)
../../gcc-source-trunk/gcc/tree.c:5012
0x10763ad attribute_list_contained(tree_node const*, tree_node const*)
../../gcc-source-trunk/gcc/tree.c:7225
0x107e4d8 merge_attributes(tree_node*, tree_node*)
../../gcc-source-trunk/gcc/tree.c:6241
0x75be4a save_template_attributes
../../gcc-source-trunk/gcc/cp/decl2.c:1289
0x75be4a cplus_decl_attributes(tree_node**, tree_node*, int)
../../gcc-source-trunk/gcc/cp/decl2.c:1475
0x78b9ff cp_parser_class_head
../../gcc-source-trunk/gcc/cp/parser.c:22028
0x78b9ff cp_parser_class_specifier_1
../../gcc-source-trunk/gcc/cp/parser.c:21305
0x78b9ff cp_parser_class_specifier
../../gcc-source-trunk/gcc/cp/parser.c:21601
0x78b9ff cp_parser_type_specifier
../../gcc-source-trunk/gcc/cp/parser.c:15841
0x7a4653 cp_parser_decl_specifier_seq
../../gcc-source-trunk/gcc/cp/parser.c:12763
0x7aebc5 cp_parser_single_declaration
../../gcc-source-trunk/gcc/cp/parser.c:25786
0x7aef3c cp_parser_template_declaration_after_parameters
../../gcc-source-trunk/gcc/cp/parser.c:25485
0x7af948 cp_parser_explicit_template_declaration
../../gcc-source-trunk/gcc/cp/parser.c:25713
0x7af948 cp_parser_template_declaration_after_export
../../gcc-source-trunk/gcc/cp/parser.c:25731
0x7b6e29 cp_parser_declaration
../../gcc-source-trunk/gcc/cp/parser.c:12097
0x7b5804 cp_parser_declaration_seq_opt
../../gcc-source-trunk/gcc/cp/parser.c:12027
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.
$
---------------------------------------------
template < int N > struct alignas(N) A;
template < int N > struct alignas(N) A {};