From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id C58AA385783D; Mon, 7 Dec 2020 14:56:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C58AA385783D Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/PR97868-tsan-fences)] Add -Wtsan. X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/PR97868-tsan-fences X-Git-Oldrev: ebdfd1606da6b5aa586b0cd156b69b659235c9c2 X-Git-Newrev: a644a9bb8ddb9803c9aa033dc86bb03ceac9e895 Message-Id: <20201207145634.C58AA385783D@sourceware.org> Date: Mon, 7 Dec 2020 14:56:34 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Dec 2020 14:56:34 -0000 https://gcc.gnu.org/g:a644a9bb8ddb9803c9aa033dc86bb03ceac9e895 commit a644a9bb8ddb9803c9aa033dc86bb03ceac9e895 Author: Martin Liska Date: Mon Dec 7 15:55:59 2020 +0100 Add -Wtsan. Diff: --- gcc/common.opt | 4 ++++ gcc/tsan.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/gcc/common.opt b/gcc/common.opt index 6645539f5e5..6c24c7bbffb 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -842,6 +842,10 @@ Wvector-operation-performance Common Var(warn_vector_operation_performance) Warning Warn when a vector operation is compiled outside the SIMD. +Wtsan +Common Var(warn_tsan) Init(1) Warning +Warn about unsupported features in the ThreadSanitizer. + Xassembler Driver Separate diff --git a/gcc/tsan.c b/gcc/tsan.c index 4d6223454b5..be9fabea62a 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 by ThreadSanitizer and may " + "lead to false positives", "atomic_thread_fence"); + tree decl = builtin_decl_implicit (tsan_atomic_table[i].tsan_fcode); if (decl == NULL_TREE) return;