https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109893
Bug ID: 109893 Summary: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-160-gf828503eeb79ad1f1ada6db7deccc5abcc2f3ca3 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: --- void foo(void); void bar(void); static char a; static int b, e, f; static int *c = &b, *g; int main() { int *j = 0; if (a) { g = 0; if (c) bar(); } else { j = &e; c = 0; } if (c == &f == b || c == &e) ; else __builtin_unreachable(); if (g || e) { if (j == &e || j == 0) ; else foo(); } a = 4; } gcc -O3: main: cmpb $0, a(%rip) je .L2 xorl %esi, %esi cmpq $0, c(%rip) movq %rsi, g(%rip) je .L7 pushq %rdx call bar movb $4, a(%rip) xorl %eax, %eax popq %rcx ret .L2: xorl %eax, %eax movq %rax, c(%rip) .L7: movb $4, a(%rip) xorl %eax, %eax ret c: .quad b gcc-trunk -O3 main: subq $8, %rsp cmpb $0, a(%rip) je .L2 xorl %edx, %edx cmpq $0, c(%rip) movq %rdx, g(%rip) je .L6 call bar xorl %eax, %eax .L4: cmpq $0, g(%rip) je .L9 .L6: movb $4, a(%rip) xorl %eax, %eax addq $8, %rsp ret .L2: xorl %eax, %eax movq %rax, c(%rip) movl $e, %eax jmp .L4 .L9: cmpl $0, e(%rip) je .L6 testq %rax, %rax je .L6 cmpq $e, %rax je .L6 call foo jmp .L6 c: .quad b Bisects to: https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=f828503eeb79ad1f1ada6db7deccc5abcc2f3ca3