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

            Bug ID: 96638
           Summary: [10/11 Regression] ICE in chainon, at tree.c:3169
           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: ---

Input:
//small.cc
void foo(int[] alignas[1] alignas()){}

Command:
g++ small.cc

Output:
small.cc:1:23: error: expected ‘(’ before ‘[’ token
    1 | void foo(int[] alignas[1] alignas()){}
      |                       ^
      |                       (
small.cc:1:35: error: expected primary-expression before ‘)’ token
    1 | void foo(int[] alignas[1] alignas()){}
      |                                   ^
small.cc:1:38: internal compiler error: in chainon, at tree.c:3169
    1 | void foo(int[] alignas[1] alignas()){}
      |                                      ^
0x7ea11e chainon(tree_node*, tree_node*)
        ../../gcc/tree.c:3169
0x7ea11e chainon(tree_node*, tree_node*)
        ../../gcc/tree.c:3152
0x93ad08 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/cp/decl.c:12060
0x9f275e cp_parser_parameter_declaration_list
        ../../gcc/cp/parser.c:22705
0x9f2b21 cp_parser_parameter_declaration_clause
        ../../gcc/cp/parser.c:22622
0x9df4f1 cp_parser_direct_declarator
        ../../gcc/cp/parser.c:21299
0x9df4f1 cp_parser_declarator
        ../../gcc/cp/parser.c:21163
0x9f4756 cp_parser_init_declarator
        ../../gcc/cp/parser.c:20663
0x9d4f7c cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13811
0xa002fe cp_parser_declaration
        ../../gcc/cp/parser.c:13510
0xa009db cp_parser_translation_unit
        ../../gcc/cp/parser.c:4793
0xa009db c_parse_file()
        ../../gcc/cp/parser.c:44095
0xb1b9fd 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.

This only occurs in GCC-trunk, GCC-10 performs well in error-recovery.

Reply via email to