Index: compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h =================================================================== --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_atomic_clang_other.h @@ -86,7 +86,7 @@ typename T::Type cur; for (;;) { cur = __sync_val_compare_and_swap(&a->val_dont_use, cmp, v); - if (cmp == v) + if (cur == cmp || cur == v) break; cmp = cur; }