Bug 84730 - internal compiler error: Segmentation fault (build_class_member_access_expr)
Summary: internal compiler error: Segmentation fault (build_class_member_access_expr)
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 8.0.1
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords: error-recovery, ice-on-invalid-code
Depends on:
Blocks: NSDMI
  Show dependency treegraph
 
Reported: 2018-03-06 10:43 UTC by Vegard Nossum
Modified: 2021-08-11 22:10 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.7.4, 8.0.1
Last reconfirmed: 2021-08-08 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vegard Nossum 2018-03-06 10:43:31 UTC
Input:

struct {
  int a;
  struct {
    int b = decltype(b);
    int a;
  };
};

Output:

$ xgcc -x c++ -S -
<stdin>:5:9: error: 'int <unnamed struct>::<unnamed struct>::a' conflicts with a previous declaration
<stdin>:2:7: note: previous declaration 'int <unnamed struct>::a'
<stdin>:4:22: internal compiler error: Segmentation fault
0x3152ce9 crash_signal
        /home/vegard/git/gcc/gcc/toplev.c:325
0x1409270 build_class_member_access_expr(cp_expr, tree_node*, tree_node*, bool, int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:2408
0x140a55a build_class_member_access_expr(cp_expr, tree_node*, tree_node*, bool, int)
        /home/vegard/git/gcc/gcc/cp/typeck.c:2501
0x12a9da1 finish_non_static_data_member(tree_node*, tree_node*, tree_node*)
        /home/vegard/git/gcc/gcc/cp/semantics.c:1860
0x12aec62 finish_id_expression(tree_node*, tree_node*, tree_node*, cp_id_kind*, bool, bool, bool*, bool, bool, bool, bool, char const**, unsigned int)
        /home/vegard/git/gcc/gcc/cp/semantics.c:3726
0xf7b055 cp_parser_decltype_expr
        /home/vegard/git/gcc/gcc/cp/parser.c:14001
0xf7b055 cp_parser_decltype
        /home/vegard/git/gcc/gcc/cp/parser.c:14135
0xf2db37 cp_parser_simple_type_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:17065
0xf76736 cp_parser_postfix_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:6951
0xf2a4b7 cp_parser_unary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:8322
0xebfeca cp_parser_cast_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9090
0xec24f6 cp_parser_binary_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9191
0xec62ca cp_parser_assignment_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9486
0xecc0a3 cp_parser_constant_expression
        /home/vegard/git/gcc/gcc/cp/parser.c:9770
0xed334e cp_parser_initializer_clause
        /home/vegard/git/gcc/gcc/cp/parser.c:21916
0xedc293 cp_parser_initializer
        /home/vegard/git/gcc/gcc/cp/parser.c:21856
0xedc4d1 cp_parser_late_parse_one_default_arg
        /home/vegard/git/gcc/gcc/cp/parser.c:27761
0xf15be0 cp_parser_late_parsing_nsdmi
        /home/vegard/git/gcc/gcc/cp/parser.c:27813
0xf15be0 cp_parser_class_specifier_1
        /home/vegard/git/gcc/gcc/cp/parser.c:22715
0xf231cb cp_parser_class_specifier
        /home/vegard/git/gcc/gcc/cp/parser.c:22768


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

Built from git 11a93d7a09b871b3b9a2eb108eb91ad83d94e070 (r258271).

7.3.0 gives:

<source>:5:9: error: redeclaration of 'int <unnamed struct>::<unnamed struct>::a'
     int a;
         ^
<source>:2:7: note: previous declaration 'int <unnamed struct>::a'
   int a;
       ^
<source>:4: confused by earlier errors, bailing out
Compiler returned: 1

Test case was minimised by C-Reduce.
Comment 1 Marek Polacek 2018-03-06 10:48:23 UTC
Confirmed, even 4.7 ICEs.