https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97868
Bug ID: 97868
Summary: warn about using fences with TSAN
Product: gcc
Version: 10.2.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: glisse at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org, marxin at
gcc dot gnu.org
Target Milestone: ---
The thread sanitizer (-fsanitize=thread) does not handle C++
atomic_thread_fence. This is barely acknowledged in the documentation, but
causes a number of users to waste a lot of time trying to understand how the
reported race could occur. Ideally, it would be supported, but that seems hard.
What does seem doable is adding a warning for programs using fences with tsan.
I don't really care if it is a compile-time warning, or a runtime warning, and
in the second case whether it appears as soon as a fence is executed or only as
a note after reported races, as long as I get a hint about it.