https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123724
Bug ID: 123724
Summary: [16 Regression] ICE in aarch64_possible_by_lane_insn_p
-> vect_stmt_to_vectorize since r16-6497
Product: gcc
Version: 16.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: jakub at gcc dot gnu.org
Target Milestone: ---
Since r16-6497-ge3a2fff040204ce71f8b7fbc6aa09e839982735a following testcase
(reduced from root package) ICEs with -O2 -g:
TargetLoweringBase.cpp.ii: In constructor ‘A::A(std::initializer_list<int>)’:
TargetLoweringBase.cpp.ii:17:50: warning: initializing ‘A::a1’ from
‘std::initializer_list<int>::begin’ does not extend the lifetime of the
underlying array [-Winit-list-lifetime]
17 | A (std::initializer_list<int> x) : a1 (x.begin ()), a2 (x.size ()) {}
| ~~~~~~~~^~
during GIMPLE pass: vect
TargetLoweringBase.cpp.ii: In member function ‘void K::baz()’:
TargetLoweringBase.cpp.ii:62:1: internal compiler error: Segmentation fault
62 | K::baz ()
| ^
0x3031ea6 internal_error(char const*, ...)
../../gcc/diagnostic-global-context.cc:787
0x129ca4c crash_signal
../../gcc/toplev.cc:325
0x16446e7 vect_stmt_to_vectorize(_stmt_vec_info*)
../../gcc/tree-vectorizer.h:2019
0x180b107 aarch64_possible_by_lane_insn_p
../../gcc/config/aarch64/aarch64.cc:18505
0x180b442 aarch64_vector_costs::add_stmt_cost(int, vect_cost_for_stmt,
_stmt_vec_info*, _slp_tree*, tree_node*, int, vect_cost_model_location)
../../gcc/config/aarch64/aarch64.cc:18579
0x167371e add_stmt_cost(vector_costs*, int, vect_cost_for_stmt,
_stmt_vec_info*, _slp_tree*, tree_node*, int, vect_cost_model_location)
../../gcc/tree-vectorizer.h:2094
0x167385a add_stmt_costs(vector_costs*, vec<stmt_info_for_cost, va_heap,
vl_ptr>*)
../../gcc/tree-vectorizer.h:2124
0x16aa880 vect_slp_analyze_operations(vec_info*)
../../gcc/tree-vect-slp.cc:9271
0x1652d84 vect_analyze_loop_2
../../gcc/tree-vect-loop.cc:2341
0x165479a vect_analyze_loop_1
../../gcc/tree-vect-loop.cc:2816
0x16551fb vect_analyze_loop(loop*, gimple*, vec_info_shared*)
../../gcc/tree-vect-loop.cc:2997
0x16d6b54 try_vectorize_loop_1
../../gcc/tree-vectorizer.cc:1097
0x16d7092 try_vectorize_loop
../../gcc/tree-vectorizer.cc:1216
0x16d736c execute
../../gcc/tree-vectorizer.cc:1333
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.
namespace std {
template <class> struct initializer_list {
int *_M_array;
decltype (sizeof 0) _M_len;
long size () { return _M_len; }
int *begin () { return _M_array; }
};
}
template <int v> struct integral_constant {
static constexpr int value = v;
};
template <bool v> using bool_constant = integral_constant<v>;
template <bool, typename T> using enable_if_t = T;
struct A {
int *a1;
long a2;
A (std::initializer_list<int> x) : a1 (x.begin ()), a2 (x.size ()) {}
int *begin () { return a1; }
int *end () { return a1 + a2; }
};
int b;
long c;
struct D {
void operator+ (long x) { long &r = c; __builtin_add_overflow (c, x, &r); }
template <typename E, enable_if_t <bool_constant <__is_enum (int)>::value,
bool> = 0>
E to () { return E (); }
};
template <typename T>
struct F {
T operator* () { return f.to <T> (); }
bool operator!= (F) { return c; }
void operator++ () { f + 1; }
D f;
};
template <typename T>
struct G {
using iterator = F<T>;
G (T, T, bool);
auto begin () { return g1; }
auto end () { return g2; }
iterator g1, g2;
};
template <typename ET>
auto foo (ET Begin, ET End, int)
{
return G(Begin, End, true);
}
struct H {
enum I { I1, I2, I3 } h;
H (I) {}
static auto bar () { return foo (I1, I2, b); }
};
enum { J1, J2, J3 };
struct K {
void baz ();
H k1, k2;
void qux (unsigned x) { unsigned s = x; k3[k1.h][k2.h] |= s; }
void qux (A x, H, H) { for (auto i : x) qux (i); }
short k3[4][H::I3];
};
void
K::baz ()
{
for (H i : H::bar ())
for (H j : H::bar ())
qux ({J2, J3}, i, j);
}