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

            Bug ID: 125207
           Summary: [16/17 Regression] Wrong code at -O3
           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/nq89h4a71
Testcase:
#include <stdint.h>
typedef void *(*fp_t_5)(int64_t, int8_t, int8_t);
int16_t g2, g30, g21, g17, g16, g14, g9;
int64_t g3;
void *g12, *g13;
_Bool g22, g26;
int32_t g31;
int8_t f11(void *, fp_t_5 a1, int16_t, void *, void *)
{
lbl_br3:
    g12 = a1(8021911581202 ^ g14, 0, g9);
    if (!g22) goto lbl_br3;
    if (g2 == g17) goto lbl_br3;
    if (g26) return g30;
    goto lbl_br3;
}
void *f2(int64_t a0, int8_t, int8_t a2)
{
    g26 = 6;
    g22 = -3 < g16;
    g13 = 0;
    if (g3 == a0) goto lbl_b16;
    g31 = 1371635658 - -682422900;
    a0 = g31;
lbl_b16:
    if (a0 != 2054058558) goto lbl_br25;
    if (a2 != 80) return 0;
lbl_br25:
    g17 = 6;
    g21 = f11(0, f2, 0, 0, 0);
    return 0;
}
void f1() { f2(0, 0, 0); }
int main() { f2(0, 0, 0); }

If you compile this testcase at -O3 and run it, it will trigger a segmentation
fault.

Reply via email to