aboutsummaryrefslogtreecommitdiff
path: root/gcc/tsan.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-12-07 15:55:59 +0100
committerMartin Liska <mliska@suse.cz>2020-12-16 10:25:32 +0100
commit8833eab4461b4b7050f06a231c3311cc1fa87523 (patch)
tree311bae63eda19649eb32f3383b3408d1e7891598 /gcc/tsan.c
parent5c5eb7e4872025e8d5e8ae2f0e568403f7c8803d (diff)
downloadgcc-8833eab4461b4b7050f06a231c3311cc1fa87523.zip
gcc-8833eab4461b4b7050f06a231c3311cc1fa87523.tar.gz
gcc-8833eab4461b4b7050f06a231c3311cc1fa87523.tar.bz2
Add -Wtsan.
gcc/ChangeLog: PR sanitizer/97868 * common.opt: Add new warning -Wtsan. * doc/invoke.texi: Likewise. * tsan.c (instrument_builtin_call): Warn users about unsupported std::atomic_thread_fence. gcc/testsuite/ChangeLog: PR sanitizer/97868 * gcc.dg/tsan/atomic-fence.c: New test.
Diffstat (limited to 'gcc/tsan.c')
-rw-r--r--gcc/tsan.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/tsan.c b/gcc/tsan.c
index 4d62234..1bc020e 100644
--- a/gcc/tsan.c
+++ b/gcc/tsan.c
@@ -45,6 +45,7 @@ along with GCC; see the file COPYING3. If not see
#include "asan.h"
#include "builtins.h"
#include "target.h"
+#include "diagnostic-core.h"
/* Number of instrumented memory accesses in the current function. */
@@ -500,6 +501,11 @@ instrument_builtin_call (gimple_stmt_iterator *gsi)
continue;
else
{
+ if (fcode == BUILT_IN_ATOMIC_THREAD_FENCE)
+ warning_at (gimple_location (stmt), OPT_Wtsan,
+ "%qs is not supported with %qs", "atomic_thread_fence",
+ "-fsanitize=thread");
+
tree decl = builtin_decl_implicit (tsan_atomic_table[i].tsan_fcode);
if (decl == NULL_TREE)
return;