On Tue, May 11, 2010 at 4:31 PM, Konstantin Serebryany < [email protected]> wrote:
> > > On Tue, May 11, 2010 at 6:27 PM, Bart Van Assche <[email protected]>wrote: > >> On Tue, May 11, 2010 at 11:20 AM, Konstantin Serebryany < >> [email protected]> 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. >> >> Oops, my fault... > Indeed, a reproducer for a std::locale::locale() would be nice. I haven't > seen it so far... > No problem. Regarding the race on the std::string refcount: this race is a really annoying one. According to the information in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40518 this issue has been fixed in both gcc 4.4.4 and gcc 4.5.0. The output I get with Valgrind r11128 (trunk) and gcc 4.4.4 (which included libstdc++ version 6.0.13) confirms this: $ export LD_LIBRARY_PATH=/home/bart/gcc-4.4.4/lib64:/home/bart/gmp-5.0.1/lib:/home/bart/mpfr-2.4.2/lib:/home/bart/mpc-0.8.1/lib: $ ~/software/valgrind/vg-in-place --tool=drd --gen-suppressions=all bin/racecheck_unittest-linux-amd64-O0 --gtest_filter="NegativeTests.EmptyRepTest" ==28564== drd, a thread error detector ==28564== Copyright (C) 2006-2010, and GNU GPL'd, by Bart Van Assche. ==28564== Using Valgrind-3.6.0.SVN and LibVEX; rerun with -h for copyright info ==28564== Command: bin/racecheck_unittest-linux-amd64-O0 --gtest_filter=NegativeTests.EmptyRepTest ==28564== Not running under ThreadSanitizer (query=hybrid_fast) Not running under ThreadSanitizer (query=pure_happens_before) FLAGS [phb=0, fm=0] No tests specified. Running default set of tests... Note: Google Test filter = NegativeTests.EmptyRepTest [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from NegativeTests [ RUN ] NegativeTests.EmptyRepTest [ OK ] NegativeTests.EmptyRepTest (42 ms) [----------] 1 test from NegativeTests (59 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (96 ms total) [ PASSED ] 1 test. YOU HAVE 4 DISABLED TESTS ==28564== ==28564== For counts of detected and suppressed errors, rerun with: -v ==28564== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 14 from 13) [b...@cell-user unittest]$ less ~/software/valgrind/glibc-2.X-drd.supp Bart.
------------------------------------------------------------------------------
_______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
