https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126405
Bug ID: 126405
Summary: [15/16/17 Regression] Wrong code at -O2 on aarch64
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
Assignee: unassigned at gcc dot gnu.org
Reporter: xxs_chy at outlook dot com
Target Milestone: ---
Reproducer: https://godbolt.org/z/1jYenKv76
Testcase:
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
typedef int64_t v16i64 __attribute__((vector_size(128)));
int64_t g2, __chk, g12;
__attribute__((__vector_size__(16 * sizeof(int)))) int g3;
v16i64 g18;
void *g27;
void f31()
{
lbl_br1:
g18 = ~g18;
g3 = ~g3;
if (g2) goto lbl_br1;
lbl_b5:
switch (g12)
case 4:
case 0:
goto lbl_sw8;
abort();
lbl_sw8:
if (g27) goto lbl_b5;
g18 = ~g18;
}
int main()
{
f31();
__chk = g18[15];
printf("checksum=0x%016llx\n", (unsigned long long)__chk);
}
This case outputs an indeterminate value at -O2, and outputs
checksum=0x0000000000000000 at -O0.