Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions openmp/tools/archer/ompt-tsan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ DECLARE_TSAN_FUNCTION(AnnotateNewMemory, const char *, int,
DECLARE_TSAN_FUNCTION(__tsan_func_entry, const void *)
DECLARE_TSAN_FUNCTION(__tsan_func_exit)

// RunningOnValgrind is used to detect absence of TSan and must intentionally be a nullptr.
static int (*RunningOnValgrind)(void);
// __tsan_init is used to detect absence of TSan and must intentionally be a nullptr.
static void (*__tsan_init)(void);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the function is never called, I suggest to declare the variable locally in ompt_start_tool.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I just pushed a second change that does that.

}

// This marker is used to define a happens-before arc. The race detector will
Expand Down Expand Up @@ -1252,12 +1252,12 @@ ompt_start_tool(unsigned int omp_version, const char *runtime_version) {

// The OMPT start-up code uses dlopen with RTLD_LAZY. Therefore, we cannot
// rely on dlopen to fail if TSan is missing, but would get a runtime error
// for the first TSan call. We use RunningOnValgrind to detect whether
// for the first TSan call. We use __tsan_init to detect whether
// an implementation of the Annotation interface is available in the
// execution or disable the tool (by returning NULL).

findTsanFunctionSilent(RunningOnValgrind, (int (*)(void)));
if (!RunningOnValgrind) // if we are not running on TSAN, give a different
findTsanFunctionSilent(__tsan_init, (void (*)(void)));
if (!__tsan_init) // if we are not running on TSAN, give a different
// tool the chance to be loaded
{
if (archer_flags->verbose)
Expand Down