diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_atomic_clang_other.h @@ -53,8 +53,7 @@ // 64-bit load on 32-bit platform. // Gross, but simple and reliable. // Assume that it is not in read-only memory. - v = __sync_fetch_and_add( - const_cast(&a->val_dont_use), 0); + __atomic_load(const_cast(&a->val_dont_use), &v, __ATOMIC_SEQ_CST); } return v; } @@ -81,14 +80,7 @@ } else { // 64-bit store on 32-bit platform. // Gross, but simple and reliable. - typename T::Type cmp = a->val_dont_use; - typename T::Type cur; - for (;;) { - cur = __sync_val_compare_and_swap(&a->val_dont_use, cmp, v); - if (cur == cmp || cur == v) - break; - cmp = cur; - } + __atomic_store(&a->val_dont_use, &v, __ATOMIC_SEQ_CST); } }