public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "67 at mniip dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/109601] New: Useless branch not eliminated when writing to a union
Date: Sun, 23 Apr 2023 18:26:22 +0000 [thread overview]
Message-ID: <bug-109601-4@http.gcc.gnu.org/bugzilla/> (raw)
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109601
Bug ID: 109601
Summary: Useless branch not eliminated when writing to a union
Product: gcc
Version: 12.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: 67 at mniip dot com
Target Milestone: ---
Created attachment 54909
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54909&action=edit
Minimal testcase
On x86_64-pc-linux-gnu the attached code compiles (with -O3) to rather
unsatisfying assembly with a branch that does the same thing whether taken or
not:
> 10: 85 c0 test %eax,%eax
> 12: 74 04 je 18
> 14: c3 ret
> 15: 0f 1f 00 nopl (%rax)
> 18: c3 ret
I've tested on my machine in GCC 12.2.1, but Compiler Explorer (
https://godbolt.org/z/cW69rfrPc ) shows the same thing happens in a lot of
other versions, including trunk (6ab856aa49bef7c04efa6144a5048e129b3a058b).
Notably, this doesn't happen in GCC 4.5.3.
This seems to happen for a few other targets as well, e.g: arm, riscv32; but
not on some others, e.g. aarch64, mips.
next reply other threads:[~2023-04-23 18:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-23 18:26 67 at mniip dot com [this message]
2023-04-23 18:48 ` [Bug rtl-optimization/109601] " pinskia at gcc dot gnu.org
2023-04-23 18:58 ` 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-109601-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: link
Be 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).