https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91416
Bug ID: 91416 Summary: ICE in cp_check_const_attributes, at cp/decl2.c:1408 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: p.vanhoof at oma dot be Target Milestone: --- Created attachment 46698 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46698&action=edit code that triggers the ICE The attached code ICEs with the following build of the trunk: % g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/local/gcc1000/lib/gcc/x86_64-pc-linux-gnu/10.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-mainline/configure --prefix=/usr/local/gcc1000 --enable-languages=c,c++,fortran Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.0.0 20190804 (experimental) (GCC) This is r274099. The command to trigger the ICE is: % g++ -g -c bug.cc The output is: bug.cc:11:3: internal compiler error: tree check: expected tree_list, have ggc_freed in cp_check_const_attributes, at cp/decl2.c:1408 11 | } ql; | ^~ 0x7f5a7b tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc-mainline/gcc/tree.c:9905 0x61da78 tree_check(tree_node*, char const*, int, char const*, tree_code) ../../gcc-mainline/gcc/tree.h:3257 0x61da78 cp_check_const_attributes(tree_node*) ../../gcc-mainline/gcc/cp/decl2.c:1408 0x959148 cp_check_const_attributes(tree_node*) ../../gcc-mainline/gcc/cp/decl2.c:1401 0x959148 cplus_decl_attributes(tree_node**, tree_node*, int) ../../gcc-mainline/gcc/cp/decl2.c:1565 0x9489f8 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int, tree_node*, tree_node*, tree_node**) ../../gcc-mainline/gcc/cp/decl.c:5167 0x9edfbf cp_parser_init_declarator ../../gcc-mainline/gcc/cp/parser.c:20374 0x9d06ce cp_parser_simple_declaration ../../gcc-mainline/gcc/cp/parser.c:13541 0x9f4e01 cp_parser_declaration ../../gcc-mainline/gcc/cp/parser.c:13238 0x9f5580 cp_parser_translation_unit ../../gcc-mainline/gcc/cp/parser.c:4709 0x9f5580 c_parse_file() ../../gcc-mainline/gcc/cp/parser.c:41688 0xaff99b c_common_parse_file() ../../gcc-mainline/gcc/c-family/c-opts.c:1160 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. The attached code compiles correctly with g++ 9.1.0. Unfortunately this appears to be a heisenbug. I tried generating the preprocessed file with -save-temps, but the ICE goes away when using that file (or even when generating the file). So I can only hope you can reproduce it with the attached file... Let me know if there is anything else I can do.