[libcxx-commits] [libcxx] 665dc40 - Attempt to clear some msan errors in the libcxx atomic tests.

via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 28 16:34:53 PDT 2020


Author: ogiroux
Date: 2020-09-28T16:34:41-07:00
New Revision: 665dc4012b65589618cc1b22f44f1e59e021145c

URL: https://github.com/llvm/llvm-project/commit/665dc4012b65589618cc1b22f44f1e59e021145c
DIFF: https://github.com/llvm/llvm-project/commit/665dc4012b65589618cc1b22f44f1e59e021145c.diff

LOG: Attempt to clear some msan errors in the libcxx atomic tests.

Added: 
    

Modified: 
    libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h

Removed: 
    


################################################################################
diff  --git a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
index c248e3ab1758..cab2264aaecd 100644
--- a/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
+++ b/libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_helpers.h
@@ -51,13 +51,21 @@ struct PaddedUserAtomicType
 
 struct LargeUserAtomicType
 {
-    int i, j[127]; /* decidedly not lock-free */
+    int a[128];  /* decidedly not lock-free */
 
-    LargeUserAtomicType(int d = 0) TEST_NOEXCEPT : i(d)
-    {}
+    LargeUserAtomicType(int d = 0) TEST_NOEXCEPT
+    {
+        for (auto && e : a)
+            e = d++;
+    }
 
-    friend bool operator==(const LargeUserAtomicType& x, const LargeUserAtomicType& y)
-    { return x.i == y.i; }
+    friend bool operator==(LargeUserAtomicType const& x, LargeUserAtomicType const& y) TEST_NOEXCEPT
+    {
+        for (int i = 0; i < 128; ++i)
+            if (x.a[i] != y.a[i])
+                return false;
+        return true;
+    }
 };
 
 template < template <class TestArg> class TestFunctor >


        


More information about the libcxx-commits mailing list