https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96437

            Bug ID: 96437
           Summary: [10/11 Regression] ICE in tree check: expected tree
                    that contains ‘decl common’ structure, have
                    ‘error_mark’ in synthesize_implicit_template_parm, at
                    cp/parser.c:44246
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: error-recovery, ice-on-invalid-code
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: haoxintu at gmail dot com
  Target Milestone: ---

Hi, all.

This code, reduced by C-Vise, makes GCC-trunk ICE, while GCC-10 and downwards
versions behave well in error-recovery.

Input:
//small.cc
template <()> void A(auto){}

Command:
g++ small.cc

Output:
small.cc:1:11: error: expected identifier before ‘(’ token
    1 | template <()> void A(auto){}
      |           ^
small.cc:1:22: internal compiler error: tree check: expected tree that contains
‘decl common’ structure, have ‘error_mark’ in
synthesize_implicit_template_parm, at cp/parser.c:44246
    1 | template <()> void A(auto){}
      |                      ^~~~
0x7c899e tree_contains_struct_check_failed(tree_node const*,
tree_node_structure_enum, char const*, int, char const*)
        ../../gcc/tree.c:9861
0x6440d9 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        ../../gcc/tree.h:3417
0x6440d9 synthesize_implicit_template_parm
        ../../gcc/cp/parser.c:44246
0x9c72b0 cp_parser_simple_type_specifier
        ../../gcc/cp/parser.c:18064
0x9aa52d cp_parser_type_specifier
        ../../gcc/cp/parser.c:17873
0x9ab50e cp_parser_decl_specifier_seq
        ../../gcc/cp/parser.c:14436
0x9c90ee cp_parser_parameter_declaration
        ../../gcc/cp/parser.c:22858
0x9c9a82 cp_parser_parameter_declaration_list
        ../../gcc/cp/parser.c:22681
0x9c9e81 cp_parser_parameter_declaration_clause
        ../../gcc/cp/parser.c:22608
0x9b6951 cp_parser_direct_declarator
        ../../gcc/cp/parser.c:21285
0x9b6951 cp_parser_declarator
        ../../gcc/cp/parser.c:21149
0x9cbab6 cp_parser_init_declarator
        ../../gcc/cp/parser.c:20649
0x9d31f4 cp_parser_single_declaration
        ../../gcc/cp/parser.c:29590
0x9d3356 cp_parser_template_declaration_after_parameters
        ../../gcc/cp/parser.c:29163
0x9d3b00 cp_parser_explicit_template_declaration
        ../../gcc/cp/parser.c:29428
0x9d76e1 cp_parser_declaration
        ../../gcc/cp/parser.c:13459
0x9d7d2b cp_parser_translation_unit
        ../../gcc/cp/parser.c:4793
0x9d7d2b c_parse_file()
        ../../gcc/cp/parser.c:44081
0xaf2e9d c_common_parse_file()
        ../../gcc/c-family/c-opts.c:1188
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.

My gcc version is
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/home/haoxin/corpus-compilers/gcc-trunk/gcc-master/build/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../configure
--prefix=/home/haoxin/corpus-compilers/gcc-trunk/gcc-master/build/
--enable-languages=c,c++ CC=gcc CXX=g++
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20200801 (experimental) (GCC) 


Thanks,
Haoxin

Reply via email to