summaryrefslogtreecommitdiffstats
path: root/openmp/runtime/src/kmp_runtime.c
diff options
context:
space:
mode:
authorJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>2016-11-07 15:58:36 +0000
committerJonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>2016-11-07 15:58:36 +0000
commit50fed0475f13e0a5868e25cc29746ac3fa32efbd (patch)
tree6df2518e60b4060c7e67ebc529d9df3270f8e25d /openmp/runtime/src/kmp_runtime.c
parent1d50fe9befc215d37af3b0459035e1022de6abde (diff)
downloadbcm5719-llvm-50fed0475f13e0a5868e25cc29746ac3fa32efbd.tar.gz
bcm5719-llvm-50fed0475f13e0a5868e25cc29746ac3fa32efbd.zip
[OpenMP] Enable ThreadSanitizer to check OpenMP programs
This patch allows ThreadSanitizer (Tsan) to verify OpenMP programs. It means that no false positive will be reported by Tsan when verifying an OpenMP programs. This patch introduces annotations within the OpenMP runtime module to provide information about thread synchronization to the Tsan runtime. In order to enable the Tsan support when building the runtime, you must enable the TSAN_SUPPORT option with the following environment variable: -DLIBOMP_TSAN_SUPPORT=TRUE The annotations will be enabled in the main shared library (same mechanism of OMPT). Patch by Simone Atzeni and Joachim Protze! Differential Revision: https://reviews.llvm.org/D13072 llvm-svn: 286115
Diffstat (limited to 'openmp/runtime/src/kmp_runtime.c')
-rw-r--r--openmp/runtime/src/kmp_runtime.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/openmp/runtime/src/kmp_runtime.c b/openmp/runtime/src/kmp_runtime.c
index bab59cb5589..3ef11ef8cc8 100644
--- a/openmp/runtime/src/kmp_runtime.c
+++ b/openmp/runtime/src/kmp_runtime.c
@@ -37,6 +37,7 @@
#include <process.h>
#endif
+#include "tsan_annotations.h"
#if defined(KMP_GOMP_COMPAT)
char const __kmp_version_alt_comp[] = KMP_VERSION_PREFIX "alternative compiler support: yes";
@@ -5669,6 +5670,7 @@ __kmp_reap_thread(
/* Assume the threads are at the fork barrier here */
KA_TRACE( 20, ("__kmp_reap_thread: releasing T#%d from fork barrier for reap\n", gtid ) );
/* Need release fence here to prevent seg faults for tree forkjoin barrier (GEH) */
+ ANNOTATE_HAPPENS_BEFORE(thread);
kmp_flag_64 flag(&thread->th.th_bar[ bs_forkjoin_barrier ].bb.b_go, thread);
__kmp_release_64(&flag);
}; // if
OpenPOWER on IntegriCloud