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

            Bug ID: 125202
           Summary: [14-17 Regression] wrong code hangs at -O1
           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/oox74rMTv
Testcase:
#include <stdint.h>
_Bool g21, g22;
int32_t g4;
void f10()
{
    if (!g22) g21 = 1;
    while (1)
        if (g21) return;
}
void f2()
{
    int32_t v1;
    int32_t v10;
    v1 = 1930638315;
lbl_br1:
    g4 = 1093211482 - v1;
    v1 = ~g4;
    v10 = v1 - g4;
    if (g22)
    {
        g22 = 0;
        goto lbl_br1;
    }
    if (v10 == 5) goto lbl_sw13;
lbl_sw13:
    f10();
}

int main()
{
    g22 = 1;
    f2();
}

This testcase hangs at -O1, and works at -O0/2/3.

Reply via email to