On Wed, Apr 21, 2010 at 5:40 AM, Jorge Moraleda <[email protected]>wrote:
> >> Hello Jorge, > >> > >> Unfortunately not all libraries have been designed with data-race > >> detection tools in mind. Several libraries contain code that triggers > >> benign data races. Examples are the I/O code in libstdc++ and in libc. > >> > >> You can either create a suppression pattern to suppress the above > >> races, or even simpler, add the following code in main() before thread > >> creation starts: > >> > >> std::ostringstream dummy; > >> dummy << 0; > >> > >> The above code will make sure that locale initialization, which is > >> triggered by sending an number to an I/O stream, will happen before > >> any threads are created and hence no races will be reported anymore on > >> locale initialization. > > > > This will not hide the race on _ZNSs4_Rep20_S_empty_rep_storageE. > > And suppressing errors in string guts may hide real races. > >> > >> Bart. > >> > > Hello Konstanting and Bart and others, > > I get race condition warnings > > ==20312== at 0x4C29303: pthread_mutex_lock > (drd_pthread_intercepts.c:580) > this looks different. Please also send the full reports next time. Did you try Helgrind and/or ThreadSanitizer? --kcc > ==20312== by 0x6EAC85E: std::locale::locale() (in > /usr/lib/libstdc++.so.6.0.13) > ==20312== by 0x6EE0C93: std::basic_stringstream<char, > std::char_traits<char>, std::allocator<char> > >::basic_stringstream(std::_Ios_Openmode) (in > /usr/lib/libstdc++.so.6.0.13) > > when constructing std::stringstream and std::istringstream's. These > look similar to the ones I asked about for std::ostringstream a few > weeks ago. I tried a similar trick to the one Konstantin suggested for > ostringstream. Namely, to write the following lines before thread > creation starts: > > std::stringstream dummy2; > dummy2 << 0; > std::istringstream dummy3(dummy2.str()); > > But I still get warnings. Is there any initialization trick that > works? Has a bug report been already filed against the stl? That is, > assuming these are real bugs, I have not been able to find any > information about locale race conditions on the web. If they are not > real bugs, but false positives, are there any "magic" drd macros, like > the one Konstantin described for the string::clear method > > extern char _ZNSs4_Rep20_S_empty_rep_storageE[32]; > DRD_IGNORE_VAR(_ZNSs4_Rep20_S_empty_rep_storageE); > > that I can include to not report these errors? > > By the way, I also get these race condition warnings for locale > initialization when using boost::lexical_cast. > > Thank you! > > Jorge >
------------------------------------------------------------------------------
_______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
