Skip to content

Commit 665dc40

Browse files
committed
Attempt to clear some msan errors in the libcxx atomic tests.
1 parent 93936da commit 665dc40

File tree

1 file changed

+13
-5
lines changed
  • libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req

1 file changed

+13
-5
lines changed

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

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,21 @@ struct PaddedUserAtomicType
5151

5252
struct LargeUserAtomicType
5353
{
54-
int i, j[127]; /* decidedly not lock-free */
54+
int a[128]; /* decidedly not lock-free */
5555

56-
LargeUserAtomicType(int d = 0) TEST_NOEXCEPT : i(d)
57-
{}
56+
LargeUserAtomicType(int d = 0) TEST_NOEXCEPT
57+
{
58+
for (auto && e : a)
59+
e = d++;
60+
}
5861

59-
friend bool operator==(const LargeUserAtomicType& x, const LargeUserAtomicType& y)
60-
{ return x.i == y.i; }
62+
friend bool operator==(LargeUserAtomicType const& x, LargeUserAtomicType const& y) TEST_NOEXCEPT
63+
{
64+
for (int i = 0; i < 128; ++i)
65+
if (x.a[i] != y.a[i])
66+
return false;
67+
return true;
68+
}
6169
};
6270

6371
template < template <class TestArg> class TestFunctor >

0 commit comments

Comments
 (0)