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

            Bug ID: 96440
           Summary: ICE in tree check: expected tree_list, have error_mark
                    in get_attribute_name, at attribs.c:841
           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 and makes released GCC
versions "confused by early errors".

Input:
//small.cc
auto alignas a [[]] [[const]] ();

Command:
g++ small.cc

Output:
small.cc:1:14: error: expected ‘(’ before ‘a’
    1 | auto alignas a [[]] [[const]] ();
      |              ^
      |              (
small.cc:1:29: internal compiler error: tree check: expected tree_list, have
error_mark in get_attribute_name, at attribs.c:841
    1 | auto alignas a [[]] [[const]] ();
      |                             ^
0x7c7fd7 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/tree.c:9687
0x6a0bd3 tree_check(tree_node const*, char const*, int, char const*, tree_code)
        ../../gcc/tree.h:3559
0x6a0bd3 get_attribute_name(tree_node const*)
        ../../gcc/attribs.c:841
0xa9e159 private_lookup_attribute(char const*, unsigned long, tree_node*)
        ../../gcc/attribs.c:1812
0x911518 lookup_attribute
        ../../gcc/attribs.h:179
0x911518 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        ../../gcc/cp/decl.c:11384
0x91d418 start_decl(cp_declarator const*, cp_decl_specifier_seq*, int,
tree_node*, tree_node*, tree_node**)
        ../../gcc/cp/decl.c:5233
0x9cbd7d cp_parser_init_declarator
        ../../gcc/cp/parser.c:20858
0x9ac3cc cp_parser_simple_declaration
        ../../gcc/cp/parser.c:13811
0x9d763e cp_parser_declaration
        ../../gcc/cp/parser.c:13510
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