[Bug c/68868] atomic_init emits an unnecessary fence
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Dec 14 02:44:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list