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

            Bug ID: 126450
           Summary: [16/17 Regression] wrong code at -O2 -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/e4jjoYTEa
Reduced case:
#include <stdint.h>
typedef int32_t v4i32 __attribute__((vector_size(16)));
int64_t g0, g25, g21, g5, g4;
int16_t g1;
__attribute__((__vector_size__(8 * sizeof(int)))) int g12;
v4i32 g27;
_Bool f18_c9;
void f18(v4i32 a0)
{
    _Bool c2 = 0, c4;
    int16_t v12 = 0;
lbl_sw3:
    g25 = v12;
    a0 = g27;
    v12 = g21 % 4;
    f18_c9 = g1 = g4 % 6;
    g4 = a0[c2];
    g12 = g12 > g12;
    if (g5) goto lbl_cont82;
lbl_br55:
    c2 = v12;
    if (c2) goto lbl_sw3;
    g0 = v12;
lbl_cont82:
    if (g4) goto lbl_br55;
}
int main() { f18(g27); }

This case terminates correctly at -O0, and triggers SIGSEGV at -O2 -mavx2.

Reply via email to