Folks, helgrind reports possible dataraces for std::string instances
which, I believe, are not dataraces.

For example, I have the following lines in the log:

==21259== Possible data race during read of size 4 at 0x5ac5ef0 by thread #6
==21259==    at 0x5A70662: std::string::_Rep::_M_is_leaked() const
(basic_string.h:189)
==21259==    by 0x5A72076:
std::string::_Rep::_M_grab(std::allocator<char> const&,
std::allocator<char> const&) (basic_string.h:221)
==21259==    by 0x5A7229B: std::basic_string<char,
std::char_traits<char>, std::allocator<char>
>::basic_string(std::string const&) (basic_string.tcc:179)
....
==21259==  This conflicts with a previous write of size 4 by thread #8
==21259==    at 0x5A70690: std::string::_Rep::_M_set_sharable()
(basic_string.h:201)
==21259==    by 0x5A1E600:
_ZNSs4_Rep26_M_set_length_and_sharableEj@@GLIBCXX_3.4.5
(basic_string.h:206)
==21259==    by 0x5A72FAC: std::string::_M_mutate(unsigned int,
unsigned int, unsigned int) (basic_string.tcc:471)
==21259==    by 0x5A738B3: std::string::_M_replace_safe(unsigned int,
unsigned int, char const*, unsigned int) (basic_string.tcc:659)
....

I examined the callstack and I'm pretty much sure there should be no
datarace since distinct std::string objects are used.
I heard std::string may internally share some data even with distinct
std::string objects but IIRC standard guarantees thread safety for
distinct std::string objects.

Probably helgrind just should be configured to suppress such errors
from std::string? And if yes, could please share your suppression
file? ;)

I'm using valgrind 3.4.1 on linux x86.

Thanks.

-- 
Best regards, Pavel

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to