[Bug c++/126752] New: ICE in build_vec_init when initializing an array member of an aggregate

"s.kimura.h41104 at gmail dot com via Gcc-bugs" <[email protected]>
Newsgroups gmane.comp.gcc.bugs
Message-ID <[email protected]/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126752

            Bug ID: 126752
           Summary: ICE in build_vec_init when initializing an array
                    member of an aggregate
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: s.kimura.h41104 at gmail dot com
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/MhTo7e9sf

Reproducer:
```
struct C {
  struct V_impl {
    constexpr V_impl() {}
  };
  struct V_base {
    ~V_base();
    V_impl v_impl;
  };
  struct vec : private V_base {};
  struct S {
    S();
  };
  struct V {
    vec vv{};
  };
  struct FOO {
    V v[1]{};
    S s;
  };
  void foo() { FOO{}; }
};
```

Backtrace:
<source>: In member function 'void C::foo()':
<source>:20:20: internal compiler error: in build_vec_init, at cp/init.cc:5368
   20 |   void foo() { FOO{}; }
      |                    ^
0x2b97f28 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x2b8cb6b internal_error(char const*, ...)
        ???:0
0xb40b7e fancy_abort(char const*, int, char const*)
        ???:0
0xe65584 expand_vec_init_expr(tree_node*, tree_node*, int, vec<tree_node*,
va_gc, vl_embed>**)
        ???:0
0xea3bb7 split_nonconstant_init(tree_node*, tree_node*)
        ???:0
0x1949d73 walk_tree_1(tree_node**, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*,
tree_node* (*)(tree_node**, int*, tree_node* (*)(tree_node**, int*, void*),
void*, hash_set<tree_node*, false, default_hash_traits<tree_node*> >*))
        ???:0
0xbf1b33 cp_fold_function(tree_node*)
        ???:0
0xc48837 finish_function(bool)
        ???:0
0xd96823 c_parse_file()
        ???:0
0xf29cf9 c_common_parse_file()
        ???:0

This ICE goes back to gcc-16:
https://godbolt.org/z/ffKno4Y4n
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.