https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126375
Bug ID: 126375
Summary: [14-17 Regression] wrong code at -O2
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/vThdzKnbb
Testcase:
#include <stdint.h>
#include <stdio.h>
int32_t g0, __chk, g27, g26, g21, g1;
int64_t g9;
void f1(int64_t a0, int8_t a1)
{
_Bool c3, c12, c14;
int32_t bb4;
g26 = g9 = 3029213072962396350;
g27 = g1 = 63;
c3 = 0;
c14 = a0 = 8268822031295518561;
lbl_br9:
g21 = ~g21;
c12 = 8920420979663668102 > a0;
__builtin_add_overflow(g9, a0, &a0);
if (c3) return;
bb4 = g1 - 109906;
if (!c12) return;
g0 = bb4;
if (!c14) return;
g1 = c3 = 0 <= a1;
c14 = 0;
goto lbl_br9;
}
int main()
{
f1(0, -4);
__chk = g0;
printf("checksum=0x%016llx\n", (unsigned long long)__chk);
}
This case outputs checksum=0xfffffffffffe52ed at -O2, and outputs
checksum=0xfffffffffffe52ae at -O0.