[Bug libstdc++/62313] Data race in debug iterators
dvyukov at google dot com
gcc-bugzilla@gcc.gnu.org
Mon Sep 1 10:12:00 GMT 2014
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62313
--- Comment #6 from Dmitry Vyukov <dvyukov at google dot com> ---
> The tests for the debug mode don't generally involve threads, so that isn't likely to help.
Then you can run any heavily multithreaded program that extensively uses stl
and is currently race-free. That last condition is somewhat tricky. I could
suggest running Chromium browser as we oversee it for data races
(http://dev.chromium.org/developers/testing/threadsanitizer-tsan-v2), but it
can be somewhat tricky.
====
The issue introduces a data race into the following program -- 'it' parameter
is constructed concurrently with list mutation. If it is a bug in user program,
them all concurrent C++ program that use stl are buggy.
class X {
std::list<int> li_;
std::mutex mu_;
public:
void erase(std::list<int>::iterator it) {
mu_.lock();
li_.erase(it);
mu_unlock();
}
};
More information about the Gcc-bugs
mailing list