Hi,
I would like to thank you for sharing Relacy in the first place.
Now I have a question... I'm perhaps wrong, but it seems that Relacy
does not simulate reordering of read/read and read/write, which I
imagine that could lead to bugs being missed. Example follows. Sorry
for the noobish code, I don't have a lot of experience using Relacy
yet.
// read/write reordering
struct my_test : rl::test_suite<my_test, 2> {
std::atomic<int> x;
std::atomic<int> y;
void before() {
x($) = 0;
y($) = 0;
}
void thread(unsigned index) {
if(index == 0) {
if(x.load(std::memory_order_relaxed)) {
y.store(1, std::memory_order_relaxed);
}
}
else {
if(y.load(std::memory_order_relaxed)) {
x.store(1, std::memory_order_relaxed);
}
}
}
void after() {
std::cout << x << " " << y << std::endl;
// outcome x = y = 1 is possible
}
};
// read/read reordering
struct my_test2 : rl::test_suite<my_test2, 2> {
std::atomic<int> x;
int a;
int b;
void before() {
x($) = 0;
}
void thread(unsigned index) {
if(index == 0) {
x.store(1, std::memory_order_relaxed);
x.store(2, std::memory_order_relaxed);
}
else {
a = x.load(std::memory_order_relaxed);
b = x.load(std::memory_order_relaxed);
}
}
void after() {
std::cout << a << " " << b << std::endl;
// outcome a = 2 and b = 1 is possible
}
};
--
You received this message because you are subscribed to the Google Groups "Relacy Race Detector" group.
To post to this group, send email to
rel...@googlegroups.com.
To unsubscribe from this group, send email to
relacy+un...@googlegroups.com.
For more options, visit this group at
http://groups.google.com/group/relacy?hl=en.