https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103066
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- If by fail you mean that it doesn't update the memory if the memory isn't equal to expected, sure, but do you mean it can fail spuriously, not update the memory even if the memory is equal to expected? Neither __sync_{bool,val}_compare_and_swap nor __atomic_compare_exchange_n with weak set to false can fail spuriously, __atomic_compare_exchange_n with weak set to true can.