|
From: folkert <fo...@va...> - 2016-04-18 22:12:28
|
Hi,
I have an application that uses std::atomic_bool to signal to threads
that they can terminate whenever they're ready for that.
Now helgrind complains that access to these variables are problematic:
"Possible data race during write of size 1 at 0x6AF7A60 by thread #1".
I would like to suppress these messages as they get repeated over and
over again.
The message is e.g.:
==7629== Possible data race during write of size 1 at 0x6AF7A60 by
thread #1
==7629== Locks held: none
==7629== at 0x4145D7: store (atomic_base.h:374)
==7629== by 0x4145D7: operator= (atomic_base.h:267)
==7629== by 0x4145D7: operator= (atomic:74)
==7629== by 0x4145D7: IO_UCI::loop() (IO_UCI.cpp:479)
==7629== by 0x40B333: main (Main.cpp:332)
==7629==
==7629== This conflicts with a previous read of size 1 by thread #2
==7629== Locks held: none
==7629== at 0x415CF5: load (atomic_base.h:396)
==7629== by 0x415CF5: operator 6 (atomic:81)
==7629== by 0x415CF5: Brain::calculateMove(Scene&, PlayerColor, int, int, int, MoveList const*, std::map<unsigned long, int, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, int> > >*, __PRAGMA_PACKED__ const*, MoveList**, int*, end_indicator_t*) (Brain.cpp:1409)
==7629== by 0x41C32F: calculateThread(void*) (IO.cpp:294)
==7629== by 0x56F928F: ??? (in /usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==7629== by 0x4C30E36: mythread_wrapper (hg_intercepts.c:389)
==7629== by 0x5EDF283: start_thread (pthread_create.c:333)
==7629== by 0x61DD74C: clone (in /lib/x86_64-linux-gnu/libc-2.21.so)
==7629== Address 0x6af7a60 is 32 bytes inside a block of size 128 alloc'd
==7629== at 0x4C2B58F: operator new(unsigned long) (vg_replace_malloc.c:333)
==7629== by 0x40B4A8: main (Main.cpp:257)
==7629== Block was alloc'd by thread #1
My suppression-file is:
{
std::atomic_bool
Helgrind:Race
fun:load
fun:operator 4
}
Start-up:
--7629-- Valgrind options:
--7629-- --tool=helgrind
--7629-- --free-is-write=yes
--7629-- --suppressions=sup.sup
--7629-- -v
--7629-- Reading suppressions file: sup.sup
--7629-- Reading suppressions file: /usr/lib/valgrind/default.supp
Versions:
Valgrind-3.11.0
linux 4.5.0-trunk-amd64
Result: the suppressions are not ignored:
==9203==
==9203== Possible data race during write of size 1 at 0x6B014D8 by
thread #24
==9203== Locks held: none
==9203== at 0x41A50F: store (atomic_base.h:374)
==9203== by 0x41A50F: operator= (atomic_base.h:267)
==9203== by 0x41A50F: operator= (atomic:74)
==9203== by 0x41A50F: _ZN10ThreadDataclEv (ThreadData.cpp:117)
==9203== by 0x56F928F: ??? (in
/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.21)
==9203== by 0x4C30E36: mythread_wrapper (hg_intercepts.c:389)
==9203== by 0x5EDF283: start_thread (pthread_create.c:333)
==9203== by 0x61DD74C: clone (in /lib/x86_64-linux-gnu/libc-2.21.so)
==9203==
==9203== This conflicts with a previous read of size 1 by thread #23
==9203== Locks held: none
==9203== at 0x421FE5: load (atomic_base.h:396)
==9203== by 0x421FE5: operator 4 (atomic:81)
==9203== by 0x421FE5: hasFinished (ThreadData.cpp:133)
etc
Folkert van Heusden
--
Multi tail barnamaj mowahib li mora9abat attasjilat wa nataij awamir
al 7asoub. damj, talwin, mora9abat attarchi7 wa ila akhirih.
http://www.vanheusden.com/multitail/
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com
|