https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110539
Bug ID: 110539 Summary: [14 Regression] Dead Code Elimination Regression at since r14-338-g1dd154f6407 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/h9vrrj5je Given the following code: void foo(void); static int a, c = 1; static short b; static int *d = &c, *e = &a; static int **f = &d; void __assert_fail() __attribute__((__noreturn__)); static void g(short h) { if (*d) ; else { if (e) __assert_fail(); if (a) { __builtin_unreachable(); } else __assert_fail(); } if ((((0, 0) || h) == h) + b) *f = 0; } int main() { int i = 0 != 10 & a; g(i); *e = 9; e = 0; if (d == 0) ; else foo(); ; } gcc-trunk -O2 does not eliminate the call to foo: main: subq $8, %rsp movq d(%rip), %rax movq e(%rip), %rdx movl (%rax), %edi testl %edi, %edi jne .L2 xorl %eax, %eax call __assert_fail .L2: xorl %ecx, %ecx xorl %esi, %esi movq %rcx, d(%rip) cmpq $0, d(%rip) movl $9, (%rdx) movq %rsi, e(%rip) je .L3 call foo .L3: xorl %eax, %eax popq %rdx ret gcc-13.1.0 -O2 eliminates the call to foo: main: movq d(%rip), %rax movq e(%rip), %rdx movl (%rax), %esi testl %esi, %esi jne .L2 pushq %rcx xorl %eax, %eax call __assert_fail .L2: xorl %eax, %eax movq %rax, d(%rip) xorl %eax, %eax movl $9, (%rdx) xorl %edx, %edx movq %rdx, e(%rip) ret Bisects to r14-338-g1dd154f6407