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

            Bug ID: 87324
           Summary: g++ ICE with overriding initializers: Segmentation
                    fault
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 9.0.0 20180915 (experimental) [trunk revision 264342] (GCC)


$ g++-trunk abc.C
abc.C:9:18: error: ‘.a’ designator used multiple times in the same initializer
list
9 | } d{.a = 7, .a = 8.09};
  |                  ^~~~
abc.C:9:22: internal compiler error: Segmentation fault
9 | } d{.a = 7, .a = 8.09};
  |                      ^
0xee340f crash_signal
        ../../gcc/gcc/toplev.c:325
0x923dc0 tree_check(tree_node*, char const*, int, char const*, tree_code)
        ../../gcc/gcc/tree.h:3112
0x923dc0 get_class_binding_direct(tree_node*, tree_node*, int)
        ../../gcc/gcc/cp/name-lookup.c:1222
0xa176b8 process_init_constructor_record
        ../../gcc/gcc/cp/typeck2.c:1603
0xa176b8 process_init_constructor
        ../../gcc/gcc/cp/typeck2.c:1752
0xa176b8 digest_init_r
        ../../gcc/gcc/cp/typeck2.c:1166
0xa185e2 digest_init_flags(tree_node*, tree_node*, int, int)
        ../../gcc/gcc/cp/typeck2.c:1211
0xa185e2 store_init_value(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, int)
        ../../gcc/gcc/cp/typeck2.c:808
0x8aee6d check_initializer
        ../../gcc/gcc/cp/decl.c:6479
0x8c6ebf cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
        ../../gcc/gcc/cp/decl.c:7146
0x961bf6 cp_parser_init_declarator
        ../../gcc/gcc/cp/parser.c:19893
0x968de3 cp_parser_simple_declaration
        ../../gcc/gcc/cp/parser.c:13189
0x96ddf2 cp_parser_declaration
        ../../gcc/gcc/cp/parser.c:12912
0x96e1ed cp_parser_declaration_seq_opt
        ../../gcc/gcc/cp/parser.c:12788
0x96e4e4 cp_parser_translation_unit
        ../../gcc/gcc/cp/parser.c:4610
0x96e4e4 c_parse_file()
        ../../gcc/gcc/cp/parser.c:39122
0xa6cb3b c_common_parse_file()
        ../../gcc/gcc/c-family/c-opts.c:1139
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.


$ cat abc.C
struct {
  struct {
    double a;
    struct {
      short b;
    };
  };
  int c;
} d{.a = 7, .a = 8.09};

Reply via email to