public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "theodort at inf dot ethz.ch" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110413] New: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-1880-g827e208fa64 Date: Mon, 26 Jun 2023 15:00:46 +0000 [thread overview] Message-ID: <bug-110413-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110413 Bug ID: 110413 Summary: [14 Regression] Missed Dead Code Elimination when using __builtin_unreachable since r14-1880-g827e208fa64 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/75vvarEvs Given the following code: void foo(void); static int a, b, d, e, g, h; static short f; static int *i, *k; static int **l = &i; void __assert_fail(char *, char *, int, char *) __attribute__((__noreturn__)); static int(c)() { return a + b; } static int *j() { f | e & 4073709551611 && c(); return &d; } int main() { *l = j(); h = 5; for (; h; h--) { k = j(); if (k && k <= &d) ; else { __builtin_unreachable(); __assert_fail("", "", 0, __PRETTY_FUNCTION__); } } if (k || k == &g) ; else foo(); ; } gcc-trunk -O1 does not eliminate the call to foo: j: movl $d, %eax ret main: subq $8, %rsp movl $0, %eax call j movq %rax, i(%rip) movq %rax, k(%rip) movl $0, h(%rip) cmpq $g, %rax je .L3 testq %rax, %rax je .L5 .L3: movl $0, %eax addq $8, %rsp ret .L5: call foo jmp .L3 gcc-13.1.0 -O1 eliminates the call to foo: j: movl $d, %eax ret main: movl $0, %eax call j movq %rax, i(%rip) movq %rax, k(%rip) movl $0, h(%rip) movl $0, %eax ret Bisects to r14-1880-g827e208fa64
next reply other threads:[~2023-06-26 15:00 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-06-26 15:00 theodort at inf dot ethz.ch [this message] 2023-06-27 6:31 ` [Bug tree-optimization/110413] " rguenth at gcc dot gnu.org 2023-06-27 9:34 ` rguenth at gcc dot gnu.org 2023-09-02 20:52 ` pinskia at gcc dot gnu.org 2024-03-08 15:30 ` law at gcc dot gnu.org 2024-05-07 7:40 ` [Bug tree-optimization/110413] [14/15 " rguenth at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-110413-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).