https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110173
Bug ID: 110173 Summary: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25 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/ssja5dKdY void foo(void); static int e, f, n, *g, **h = &g; static short m; void __assert_fail() __attribute__((__noreturn__)); static short(a)(short b) { return b; } static short(c)(short d) { if (!(((d) >= 1) && ((d) <= 1))) { __builtin_unreachable(); } return 0; } static int *j(); static void k(int *l, char) { *l = 0; if (g == &e || g == 0 || g == &f); else { foo(); __assert_fail(); } c(f < 5); } static void i() { *h = j(); } static int *j(unsigned o) { char p; if (g == &f || g == 0); else __assert_fail(); p = m > (a(1) && o); k(&n, p); if (g == 0); else __assert_fail(); return 0; } int main() { i(); } gcc-trunk -Os -S: main: movq g(%rip), %rax testq %rax, %rax je .L2 cmpq $f, %rax je .L2 .L3: pushq %rsi xorl %eax, %eax call __assert_fail .L2: xorl %ecx, %ecx movl %ecx, n(%rip) testq %rax, %rax jne .L3 xorl %edx, %edx movq %rdx, g(%rip) ret main: pushq %rsi movq g(%rip), %rax cmpq $f, %rax je .L2 testq %rax, %rax jne .L13 .L2: xorl %ecx, %ecx movl %ecx, n(%rip) cmpq $f, %rax je .L3 testq %rax, %rax je .L11 call foo .L13: xorl %eax, %eax call __assert_fail .L3: testq %rax, %rax jne .L13 .L11: xorl %eax, %eax movq %rax, g(%rip) xorl %eax, %eax popq %rdx ret Bisects to r14-569-g21e2ef2dc25