Skip to content

Commit b3d7222

Browse files
committed
Move the function pointer for __tsan_init from file static to function local.
1 parent 3760da0 commit b3d7222

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

openmp/tools/archer/ompt-tsan.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,6 @@ DECLARE_TSAN_FUNCTION(AnnotateNewMemory, const char *, int,
166166
const volatile void *, size_t)
167167
DECLARE_TSAN_FUNCTION(__tsan_func_entry, const void *)
168168
DECLARE_TSAN_FUNCTION(__tsan_func_exit)
169-
170-
// __tsan_init is used to detect absence of TSan and must intentionally be a nullptr.
171-
static void (*__tsan_init)(void);
172169
}
173170

174171
// This marker is used to define a happens-before arc. The race detector will
@@ -1256,6 +1253,8 @@ ompt_start_tool(unsigned int omp_version, const char *runtime_version) {
12561253
// an implementation of the Annotation interface is available in the
12571254
// execution or disable the tool (by returning NULL).
12581255

1256+
void (*__tsan_init)(void) = nullptr;
1257+
12591258
findTsanFunctionSilent(__tsan_init, (void (*)(void)));
12601259
if (!__tsan_init) // if we are not running on TSAN, give a different
12611260
// tool the chance to be loaded

0 commit comments

Comments
 (0)