> I'm not sure what can be done then, to avoid a helgrind warning. If you can guarantee that "// some calculation goes here" touches only thread-local state, then there is only a race on sharedInt itself. In which case, use VALGRIND_HG_{DISABLE,ENABLE}_CHECKING to disable reporting on the relevant specific instances of the sharedInt.
If "// some calculation goes here" touches shared state then you will have to use VALGRIND_{DISABLE,ENABLE}_ERROR_REPORTING instead. This is a heavyweight and undesirable solution, though. ---------- My understanding of this is that it is in violation of the C++11 memory model, which says that "the implementation" may deliver stores from one core to another in any order, in the absence of any C++11 mandated inter- thread synchronisation. You can argue that for x86 the hardware's TSO guarantees make this harmless ... > Marc Mutz said " > The standard says it's racy, but the implementation of ... but AIUI, "the implementation" also includes the compiler, and I believe it has been observed that GCC will indeed break your code in unexpected ways, in some cases. In short you need to prove that not only the hardware won't reorder stores between cores -- which for x86 happens to be true -- but also the compiler won't. J ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users