public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rafael at espindo dot la" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/95014] New: gcc fails to merge two identical returns Date: Fri, 08 May 2020 18:40:05 +0000 [thread overview] Message-ID: <bug-95014-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95014 Bug ID: 95014 Summary: gcc fails to merge two identical returns Product: gcc Version: 10.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: rafael at espindo dot la Target Milestone: --- Given #include <new> union any { any(any&& x) noexcept { if (x.st < 4) { st = x.st; x.st = 0; } else { ex = x.ex; x.ex = nullptr; } } long st; void* ex; }; void f(any* a, any* b) { new (a) any(std::move(*b)); } gcc produces movq (%rsi), %rax movq %rax, (%rdi) movq $0, (%rsi) cmpq $3, %rax jg .L2 ret .L2: ret clang produces movq (%rsi), %rax cmpq $3, %rax movq %rax, (%rdi) movq $0, (%rsi) retq So clang has a redundant cmpq and gcc has the cmpq and two identical branch destinations.
next reply other threads:[~2020-05-08 18:40 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-05-08 18:40 rafael at espindo dot la [this message] 2021-04-30 17:58 ` [Bug middle-end/95014] " vanyacpp at gmail dot com 2021-08-01 18:28 ` pinskia at gcc dot gnu.org 2023-08-08 6:23 ` pinskia 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-95014-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).