This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/68908] inefficient code for _Atomic operations
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Dec 2015 21:49:05 +0000
- Subject: [Bug c/68908] inefficient code for _Atomic operations
- Auto-submitted: auto-generated
- References: <bug-68908-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68908
--- Comment #8 from joseph at codesourcery dot com <joseph at codesourcery dot com> ---
I'm fine with making the front end smarter. Note that if either side of
the assignment is of floating-point type, you need to keep the existing
logic; if you're adding to / subtracting from a pointer, you need to
ensure the multiplication by the size of the pointer target type still
occurs; and if the arithmetic operation might be sanitized, you probably
need to keep the existing logic as well (but otherwise, if the
__atomic_fetch_* operations never have undefined overflow, it should be
safe to do the operation in the type of the LHS).