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.