public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/110173] New: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25
@ 2023-06-08 14:07 theodort at inf dot ethz.ch
  2023-06-08 14:09 ` [Bug tree-optimization/110173] " theodort at inf dot ethz.ch
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: theodort at inf dot ethz.ch @ 2023-06-08 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-05-21  9:15 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 14:07 [Bug tree-optimization/110173] New: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-569-g21e2ef2dc25 theodort at inf dot ethz.ch
2023-06-08 14:09 ` [Bug tree-optimization/110173] " theodort at inf dot ethz.ch
2023-06-08 14:17 ` pinskia at gcc dot gnu.org
2023-06-08 18:26 ` pinskia at gcc dot gnu.org
2023-06-08 18:41 ` pinskia at gcc dot gnu.org
2023-06-08 18:43 ` [Bug tree-optimization/110173] " pinskia at gcc dot gnu.org
2023-06-08 18:46 ` [Bug tree-optimization/110173] [13/14 Regression] Missed Dead Code Elimination when using __builtin_unreachable pinskia at gcc dot gnu.org
2023-06-19 12:05 ` theodort at inf dot ethz.ch
2023-07-27  9:26 ` rguenth at gcc dot gnu.org
2024-03-08 15:35 ` law at gcc dot gnu.org
2024-05-21  9:15 ` [Bug tree-optimization/110173] [13/14/15 " jakub at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).