This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/68868] atomic_init emits an unnecessary fence
- From: "msebor at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 14 Dec 2015 02:43:56 +0000
- Subject: [Bug c/68868] atomic_init emits an unnecessary fence
- Auto-submitted: auto-generated
- References: <bug-68868-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68868
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2015-12-14
Assignee|unassigned at gcc dot gnu.org |msebor at gcc dot gnu.org
Ever confirmed|0 |1
Known to fail| |4.9.2, 5.1.0, 6.0
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Unfortunately, the simple patch in the Description doesn't work for char
literals. I.e., this
atomic_char a;
atomic_init (a, 'x');
doesn't compile because __typeof__ ('x') is int and calling __atomic_store with
pointers to types of mismatching size produces:
error: size mismatch in argument 2 of â__atomic_storeâ
atomic_init (a, 'x');
^
This is likely why Clang implements atomic_init in terms of its
__c11_atomic_init intrinsic.
Assigning to self to come up with a better patch.