Comment on Reader Q&A: Is std::atomic_compare_exchange_* implementable? by Jan Ringoš
You might also want to check the thread on GCC mailing list where Linus is raising hell about atomics wording in C11 (and all the things around).