Random compare_exchange_weak behavior during RRD test

30 views
Skip to first unread message

Андрей Андрей

unread,
Sep 22, 2011, 5:36:22 AM9/22/11
to rel...@googlegroups.com
This test fails with AV during RRD test. Is it bug?

struct FailTest:
rl::test_suite<FailTest, 1>
{
std::atomic<int*> m;

void before()
{
m($)=0;
}

void thread(unsigned thread_index)
{
for(int t=0; t<100; t++)
{
int* n(NULL);

if
( !m($).compare_exchange_weak
( n,
NULL
)
)
{
  (*n)++;  //AV
}
}
}

void after()
{

}

void invariant()
{

}
};//struct FailTest

Dmitriy Vyukov

unread,
Sep 22, 2011, 3:47:23 PM9/22/11
to Relacy Race Detector
It looks like a bug in the test. What do you expect for an access to
NULL pointer?
Reply all
Reply to author
Forward
0 new messages