This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/65697] __atomic memory barriers not strong enough for __sync builtins
- From: "jakub at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Apr 2015 11:54:19 +0000
- Subject: [Bug target/65697] __atomic memory barriers not strong enough for __sync builtins
- Auto-submitted: auto-generated
- References: <bug-65697-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65697
--- Comment #15 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to mwahab from comment #14)
> The LDAXR/STLXR sequences rely on the C11/C++11 prohibition of data races.
> That the __atomic builtins assume this restriction is implied by the
> references to C11/C++11 in the documentation but should probably be made
> clearer. I'll try to write a patch, if nobody else gets there first.
The __atomic builtins are used far more widely than just as the underlying
implementation for C11/C++11 atomics. And, even on very weakly ordered
architectures like PowerPC, __atomic_ CAS __ATOMIC_SEQ_CST emits a sync (full
barrier) before the LL/SC loop and isync after the loop, so it behaves as
documented currently.