https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109669
Bug ID: 109669
Summary: Internal Compiler Error when zero-initializing
std::array
Product: gcc
Version: 13.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: carlosgalvezp at gmail dot com
Target Milestone: ---
Hi,
We are getting an ICE when bumping from
6910cad55ffc330dc9767d2c8e0b66ccfa4134af to
cc035c5d8672f87dc8c2756d9f8367903aa72d93 (GCC 13.1.0 release) on the following
reduced example:
#include <array>
template <typename T, std::size_t n>
struct Point
{
private:
T value_[n]{};
};
struct Edge
{
Point<float, 3> start{};
Point<float, 3> end{};
};
template <typename T, std::size_t n>
class StaticVector
{
public:
static StaticVector create()
{
StaticVector output;
return output;
}
private:
std::array<T, n> data{};
};
class Polygon
{
public:
using Edges = StaticVector<Edge, 3>;
Edges edges() const
{
auto edges = Edges::create();
return edges;
}
};
void foo()
{
Polygon polygon{};
auto const edges = polygon.edges();
}
Godbolt: https://godbolt.org/z/183zv1xrK
Error:
<source>: In instantiation of 'constexpr StaticVector<Edge,
3>::StaticVector()':
<source>:22:22: required from 'static StaticVector<T, n> StaticVector<T,
n>::create() [with T = Edge; long unsigned int n = 3]'
<source>:36:35: required from here
<source>:27:22: internal compiler error: Segmentation fault
27 | std::array<T, n> data{};
| ^~~~
0x234da0e internal_error(char const*, ...)
???:0
0xccea48 finish_for_cond(tree_node*, tree_node*, bool, unsigned short)
???:0
0xb7bad3 build_vec_init(tree_node*, tree_node*, tree_node*, bool, int, int,
vec<tree_node*, va_gc, vl_embed>**)
???:0
0xce5cfb expand_vec_init_expr(tree_node*, tree_node*, int, vec<tree_node*,
va_gc, vl_embed>**)
???:0
0xd200c1 digest_nsdmi_init(tree_node*, tree_node*, int)
???:0
0xb813b7 maybe_instantiate_nsdmi_init(tree_node*, int)
???:0
0xb819f9 get_nsdmi(tree_node*, bool, int)
???:0
0xba932d get_defaulted_eh_spec(tree_node*, int)
???:0
0xc76d4a maybe_instantiate_noexcept(tree_node*, int)
???:0
0xc76b5a maybe_instantiate_noexcept(tree_node*, int)
???:0
0xb5c2b3 mark_used(tree_node*, int)
???:0
0xa9931e build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc,
vl_embed>**, tree_node*, int, tree_node**, int)
???:0
0xa9a4c7 build_special_member_call(tree_node*, tree_node*, vec<tree_node*,
va_gc, vl_embed>**, tree_node*, int, int)
???:0
0xb7d468 build_aggr_init(tree_node*, tree_node*, int, int)
???:0
0xb4c768 cp_finish_decl(tree_node*, tree_node*, bool, tree_node*, int)
???:0
0xc80395 instantiate_decl(tree_node*, bool, bool)
???:0
0xcab7fb instantiate_pending_templates(int)
???:0
0xb5f735 c_parse_final_cleanups()
???:0
0xd8f918 c_common_parse_file()
???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
I tried to reduce it with creduce but creduce itself crashed :/