https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126529
Bug ID: 126529
Summary: [17 Regression] wrong code at -O3 -mavx2
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: xxs_chy at outlook dot com
Target Milestone: ---
Reproducer: https://godbolt.org/z/5ha8EEr7x
Reduced case:
#include <stdint.h>
#define BITCAST(DST_TYPE, SRC_TYPE, VALUE)
\
(union {
\
SRC_TYPE src;
\
DST_TYPE dst
\
}){ VALUE }
\
.dst
typedef int8_t v2i8 __attribute__((vector_size(2)));
typedef int16_t v8i16 __attribute__((vector_size(16)));
int32_t g27, g20, g15, g10;
v8i16 g6;
__attribute__((__vector_size__(8 * sizeof(int)))) int g13;
_Bool f27_c14;
void *__attribute__((noinline)) f27(int64_t a0, _Bool a1, int32_t a4, v8i16 a5)
{
v2i8 bc12 = {};
int16_t v17 = bc12[a4];
g13 = 0 % g13;
a5 = g6;
g10 = a5[f27_c14];
bc12 = BITCAST(v2i8, int16_t, v17);
g20 = 3 / a0;
bc12 = __builtin_shufflevector(bc12, bc12, 3, 2);
lbl_cont15:
g15 = bc12[0];
if (a1) return 0;
a1 = 1;
bc12 = ~bc12;
goto lbl_cont15;
}
int main() { f27(3355934481768670720, 0, g27, g6); }
This case triggers SIGSEGV at -O3 -mavx2, and terminates normally at -O0.