<br>> I tried that as well but there are no tsan warnings thrown at run time, even
<br>> though there are data race error!
<br>> The steps I followed:
<br>> 1. Generate bitcode using 'clang -emit-llvm' command
<br>> 2. Using the 'opt -load ..' command, I instrumented the bitcode file with my
<br>> custom pass
<br>> 3. Using the command 'opt -tsan ..', instrumented the output bitcode file
<br>> from step 2
<br>> 4. Using the llvm backend compiler, 'llc', compiled the program to native
<br>> 5. The output from step 4 is compiled again with 'clang -fsanitize=thread'
<br>> (linking tsan here) for the final object file.
<br>> Executing this final output file works fine, except that it doesn't throws
<br>> any TSAN warnings!
<br>I see 3 possibilities:
<br>1. Either the code is somehow ends up being non-instrumented, or
<br>2. tsan does not consider what it sees a data race, or
<br>3. the data race is masked by unrelated synchronization.
<br>For 1 you can check that the resulting code in fact contains __tsan_* callbacks.
<br>For 2 and 3 you can rebuilt tsan runtime with TSAN_DEBUG_OUTPUT=2
<br>define, then it will print everything it sees (memory accesses and
<br>synchronization). This output will allow us to figure out why it does
<br>not report a race.
<br></blockquote><div><br></div><div>So I guess we can rule out the 1st possibility. Can you kindly tell me how to rebuild tsan runtime? Sorry, I am new to LLVM and stuff.</div><div><br></div><div><br></div><div><br></div><div> </div></div></div>