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

            Bug ID: 84636
           Summary: internal compiler error: Segmentation fault
                    (identifier_p()/grokdeclarator())
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vegard.nossum at gmail dot com
  Target Milestone: ---

Input:

typedef void a();
struct {
  a: 1;
};

Output:

$ xgcc -x c++ -S -
<stdin>:3:6: internal compiler error: Segmentation fault
0x3150de9 crash_signal
        /home/vegard/git/gcc/gcc/toplev.c:325
0xc0c2f1 identifier_p(tree_node*)
        /home/vegard/git/gcc/gcc/cp/cp-tree.h:573
0xc0c2f1 grokdeclarator(cp_declarator const*, cp_decl_specifier_seq*,
decl_context, int, tree_node**)
        /home/vegard/git/gcc/gcc/cp/decl.c:11934
0xc47de0 grokbitfield(cp_declarator const*, cp_decl_specifier_seq*, tree_node*,
tree_node*, tree_node*)
        /home/vegard/git/gcc/gcc/cp/decl2.c:1038
0xfe10e5 cp_parser_member_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:23730
0xf160fb cp_parser_member_specification_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:23363
0xf160fb cp_parser_class_specifier_1
        /home/vegard/git/gcc/gcc/cp/parser.c:22505
0xf2501b cp_parser_class_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:22757
0xf2501b cp_parser_type_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:16763
0xf8aa5a cp_parser_decl_specifier_seq
        /home/vegard/git/gcc/gcc/cp/parser.c:13625
0xfa6620 cp_parser_simple_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12934
0xfae548 cp_parser_block_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12879
0x1001295 cp_parser_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12776
0xff826b cp_parser_declaration_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:12652
0xff9893 cp_parser_translation_unit
        /home/vegard/git/gcc/gcc/cp/parser.c:4559
0xff9893 c_parse_file()
        /home/vegard/git/gcc/gcc/cp/parser.c:38880
0x15a51f5 c_common_parse_file()
        /home/vegard/git/gcc/gcc/c-family/c-opts.c:1132

$ xgcc --version
xgcc (GCC) 8.0.1 20180228 (experimental)

Built from git fd1990b25777e5f1307eac1447e8fb5fefe747b4 (r258063).

Seems like versions all the way back to 4.4.7 (the oldest gcc on godbolt.org)
segfault. I haven't tested older compilers.

Test case was reduced by C-Reduce.

Reply via email to