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

            Bug ID: 125153
           Summary: [16/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/WGcKq8Y1d
Testcase:
#include <stdint.h>
#include <stdio.h>
int32_t g0, __chk, g6, g4;
_Bool g13, g15;
void launch()
{
    if (g13) goto lbl_bf2;
lbl_br1:
    g15 = g4 <= g6;
    g0 = g0 - 7;
    if (g15) goto lbl_bf2;
    return;
lbl_bf2:
    g6 = -1;
    goto lbl_br1;
}
int main()
{
    launch();
    __chk = g0;
    printf("checksum=0x%016llx\n", (unsigned long long)__chk);
}

Result at -O0:
> checksum=0xfffffffffffffff2
Result at -O2:
> checksum=0xffffffffffffffeb

Reply via email to