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

            Bug ID: 84588
           Summary: internal compiler error: Segmentation fault
                    (contains_struct_check())
           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: ---

This program:

struct a {
  void b() {}
  void c(auto = [] {
    if (a a(int auto){})
      ;
  }) {}
};

Invoked with:

xgcc -x c++ -std=c++14 -O3 -c -

Gives this output:

<stdin>: In lambda function:
<stdin>:4:17: error: two or more data types in declaration of 'parameter'
<stdin>: At global scope:
<stdin>:2:12: error: template definition of non-template 'void a::b()'
<stdin>:2:12: internal compiler error: Segmentation fault
0x3138779 crash_signal
        /home/vegard/git/gcc/gcc/toplev.c:325
0xf8f2f4 contains_struct_check(tree_node*, tree_node_structure_enum, char
const*, int, char const*)
        /home/vegard/git/gcc/gcc/tree.h:3245
0xf8f2f4 cp_parser_ctor_initializer_opt_and_function_body
        /home/vegard/git/gcc/gcc/cp/parser.c:21725
0xf98da5 cp_parser_function_definition_after_declarator
        /home/vegard/git/gcc/gcc/cp/parser.c:26648
0xf9b06c cp_parser_late_parsing_for_member
        /home/vegard/git/gcc/gcc/cp/parser.c:27529
0xf14765 cp_parser_class_specifier_1
        /home/vegard/git/gcc/gcc/cp/parser.c:22676
0xf1fcbb cp_parser_class_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:22702
0xf1fcbb cp_parser_type_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:16708
0xf8520a cp_parser_decl_specifier_seq
        /home/vegard/git/gcc/gcc/cp/parser.c:13573
0xfa0d60 cp_parser_simple_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12882
0xfa8c88 cp_parser_block_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12827
0xffb8d5 cp_parser_declaration
        /home/vegard/git/gcc/gcc/cp/parser.c:12724
0xff298b cp_parser_declaration_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:12600
0xff3fb3 cp_parser_translation_unit
        /home/vegard/git/gcc/gcc/cp/parser.c:4559
0xff3fb3 c_parse_file()
        /home/vegard/git/gcc/gcc/cp/parser.c:38820
0x15a0525 c_common_parse_file()
        /home/vegard/git/gcc/gcc/c-family/c-opts.c:1132
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.

Version:

xgcc (GCC) 8.0.1 20180204 (experimental)

built from git fdae6180ad24fa6303fa046114f3e4b66b8db34d

Version 7.3.0 doesn't seem to be affected AFAICS.

Test case was reduced using C-Reduce (preserving the number of errors in the
original input).

I've also submitted bug #84576 and bug #84585 which could be related.

You can also tweak the input slightly to get a different crash:

struct a {
  void b() {}
  void c(x = [] {
    if (a a(int auto){})
      ;
  }) {}
};

<stdin>:3:10: error: 'x' has not been declared
<stdin>: In lambda function:
<stdin>:4:17: error: two or more data types in declaration of 'parameter'
<stdin>:4:24: internal compiler error: in pop, at vec.h:970
0x15e7bff vec<tree_node*, va_gc, vl_embed>::pop()
        /home/vegard/git/gcc/gcc/vec.h:970
0x15e7bff pop_stmt_list(tree_node*)
        /home/vegard/git/gcc/gcc/c-family/c-semantics.c:60
0x126bf48 finish_cond
        /home/vegard/git/gcc/gcc/cp/semantics.c:561
0x126bf48 finish_if_stmt_cond(tree_node*, tree_node*)
        /home/vegard/git/gcc/gcc/cp/semantics.c:740
0xef7968 cp_parser_selection_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:11337
0xef7968 cp_parser_statement
        /home/vegard/git/gcc/gcc/cp/parser.c:10760
0xefb1eb cp_parser_statement_seq_opt
        /home/vegard/git/gcc/gcc/cp/parser.c:11218
0xfcca31 cp_parser_lambda_body
        /home/vegard/git/gcc/gcc/cp/parser.c:10632
0xfcca31 cp_parser_lambda_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:10137
0xf31764 cp_parser_primary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:5257
0xf7373b cp_parser_postfix_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:7026
0xf26fa7 cp_parser_unary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:8281
0xebcdba cp_parser_cast_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9049
0xebf3e6 cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9150
0xec2eba cp_parser_assignment_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9437
0xec8c8b cp_parser_constant_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9721
0xecffde cp_parser_initializer_clause
        /home/vegard/git/gcc/gcc/cp/parser.c:21850
0xed8f23 cp_parser_initializer
        /home/vegard/git/gcc/gcc/cp/parser.c:21790
0xed9161 cp_parser_late_parse_one_default_arg
        /home/vegard/git/gcc/gcc/cp/parser.c:27591
0xf11c65 cp_parser_late_parsing_default_args
        /home/vegard/git/gcc/gcc/cp/parser.c:27698
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.

I assume this is just a different manifestation of the same underlying bug.

Please let me know if it is useful to continue submitting new bugs or if I
should post new findings under the same bug number even though the crash/input
looks different.

Reply via email to