https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111456
Bug ID: 111456 Summary: [14 Regression] Dead Code Elimination Regression since r14-3719-gb34f3736356 Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: theodort at inf dot ethz.ch Target Milestone: --- https://godbolt.org/z/jqqP5baY8 Given the following code: void foo(void); static int i; static int *j = &i; static char l; static void(a)(char) {} static short(b)(short c, short d) { return c - d; } static short(e)(short f, int g) { return f < 0 || g < 0 || g >= 32 ? f : f >> g; } static short(h)(short f, int g) { return g >= 2 ?: f >> g; } static char k(char m, short n) { short o; int *p = &i; if (!(((m) >= 1) && ((m) <= 1))) { __builtin_unreachable(); } o = e(i, i); if (h(1, o)) ; else { m = 0; for (; m >= -20; m = b(m, 9)) if (a(i), n) { if (*p) ; else foo(); ; } else return l; } return i; } int main() { k(0 <= 0 > *j, i); } gcc-trunk -O2 does not eliminate the call to foo: main: movl i(%rip), %eax testw %ax, %ax js .L6 testl %eax, %eax jne .L6 .L9: xorl %eax, %eax ret .p2align 4,,10 .p2align 3 .L6: movswl %ax, %edx cmpw $1, %ax jg .L9 testl %edx, %edx je .L9 pushq %rbx movl $3, %ebx .L5: cmpl $0, i(%rip) je .L13 .L4: subb $1, %bl jne .L5 xorl %eax, %eax popq %rbx ret .L13: call foo jmp .L4 gcc-13.2.0 -O2 eliminates the call to foo: main: xorl %eax, %eax ret Bisects to r14-3719-gb34f3736356