|
From: Bart V. A. <bva...@ac...> - 2010-05-11 14:27:45
|
On Tue, May 11, 2010 at 11:20 AM, Konstantin Serebryany < kon...@gm...> wrote: > >> Have you already found a workaround that allows to avoid triggering >> the race report on std::locale::locale() ? If not, it would help if >> you could post a small example that allows to reproduce this behavior. >> > > You may like the test NegativeTests.EmptyRepTest from > http://code.google.com/p/data-race-test/wiki/RacecheckUnittest > > % ~/valgrind/trunk/inst/bin/valgrind --tool=helgrind > ./bin/racecheck_unittest-linux-x86-O0 > --gtest_filter="NegativeTests.EmptyRepTest" > > ==28925== Possible data race during read of size 4 at 0x7fbf5b8 by thread > #3 > ==28925== at 0x7F6F3A2: std::string::erase(unsigned int, unsigned int) > (in /usr/grte/v1/lib/libstdc++.so.6.0.9) > ==28925== by 0x804CB82: NegativeTests_EmptyRep::Worker() > (racecheck_unittest.cc:3168) > ==28925== by 0x806E806: MyThread::ThreadBody(MyThread*) > (thread_wrappers_pthread.h:329) > ==28925== by 0x47C4155: mythread_wrapper (hg_intercepts.c:213) > ==28925== by 0x47F1024: start_thread (in /usr/grte/v1/lib/ > libpthread-2.3.6.so) > ==28925== by 0x1BD4A75D: clone (in /usr/grte/v1/lib/libc-2.3.6.so) > ==28925== This conflicts with a previous write of size 4 by thread #2 > ==28925== at 0x7F6EC1B: std::string::_M_mutate(unsigned int, unsigned > int, unsigned int) (in /usr/grte/v1/lib/libstdc++.so.6.0.9) > ==28925== by 0x7F6F3C6: std::string::erase(unsigned int, unsigned int) > (in /usr/grte/v1/lib/libstdc++.so.6.0.9) > ==28925== by 0x804CB82: NegativeTests_EmptyRep::Worker() > (racecheck_unittest.cc:3168) > ==28925== by 0x806E806: MyThread::ThreadBody(MyThread*) > (thread_wrappers_pthread.h:329) > ==28925== by 0x47C4155: mythread_wrapper (hg_intercepts.c:213) > ==28925== by 0x47F1024: start_thread (in /usr/grte/v1/lib/ > libpthread-2.3.6.so) > ==28925== by 0x1BD4A75D: clone (in /usr/grte/v1/lib/libc-2.3.6.so) > > > % ~/valgrind/trunk/inst/bin/valgrind --tool=drd > ./bin/racecheck_unittest-linux-x86-O0 > --gtest_filter="NegativeTests.EmptyRepTest" > > ==28930== > ==28930== Conflicting load by thread 3 at 0x04b1f5b8 size 4 > ==28930== at 0x4ACEB7E: std::string::_M_mutate(unsigned int, unsigned > int, unsigned int) (in /usr/grte/v1/lib/libstdc++.so.6.0.9) > ==28930== by 0x4ACF3C6: std::string::erase(unsigned int, unsigned int) > (in /usr/grte/v1/lib/libstdc++.so.6.0.9) > ==28930== by 0x804CB82: NegativeTests_EmptyRep::Worker() > (racecheck_unittest.cc:3168) > ==28930== by 0x806E806: MyThread::ThreadBody(MyThread*) > (thread_wrappers_pthread.h:329) > ==28930== by 0x47C9BBD: vgDrd_thread_wrapper > (drd_pthread_intercepts.c:272) > ==28930== by 0x47F7024: start_thread (in /usr/grte/v1/lib/ > libpthread-2.3.6.so) > ==28930== by 0x4BED75D: clone (in /usr/grte/v1/lib/libc-2.3.6.so) > ==28930== Allocation context: BSS section of > /usr/grte/v1/lib/libstdc++.so.6.0.9 > ==28930== Other segment start (thread 2) > ==28930== (thread finished, call stack no longer available) > ==28930== Other segment end (thread 2) > ==28930== (thread finished, call stack no longer available) > ==28930== > Why did you post this in reply to a message about std::locale::locale() ? As far as I can see the race reported on the std::string object and the race reported on std::locale::locale() are unrelated. Bart. |