I have tried example from CLANG TSAN documentation (https://clang.llvm.org/docs/ThreadSanitizer.html):
#include
int Global;
void *Thread1(void *x) {
Global = 42;
return x;
}
int main() {
pthread_t t;
pthread_create(&t, NULL,…
I have multiple global object (say, Duck, Dog, Cat) which has to be global object, and they have a common parent class Animal.
I try to use registry pattern in such way:
declare all of these instances in global object in .cc file, like Cat…
I would like for my C++ program to be able to print if it was compiled with AddressSanitizer or ThreadSanitizer. The solution proposed in AddressSanitizer: How could we know that object file/executable in C is compiled with AddressSanitizer? will…
I'm using ThreadSanitizer with Catch2. Unfortunately, ThreadSanitizer is finding thread leaks with Catch2 and Thread race conditions in my code. Is there any way to disable ThreadSanitizer's thread leak detection but leaving on its race condition…
the following code acquire a mutex using lock_cmpxchg on an index of an array, then two threads write and read to the same index, but still thread sanitizer say there is a data race. how can I tell him the fact there is a lock between the threads…
I am trying to install and to learn how to use DataRaceBench 1.3.2 which is a benchmark suite designed to systematically and quantitatively evaluate the effectiveness of data race detection tools as shown here enter link description here.
I have a…
GCC has many sanitizers (e.g., leak, address, thread). But many of them require instumentation of the code and cannot be used together with others. So if in practice I want to apply all the sanitizers to make sure my code works well, what is a…
I'm using GCC 9.2 TSan to analyze my codebase's runtime multithreading behavior (using pthreads explicitly -- we started before C++11). I have a data race while a destroyed mutex is held, with the following (relatively unhelpful):
Mutex…
I would like to know where is a deadlock with the thread sanitizer (clang) but the problem is that the program is blocked and the deadlock is not detected during the compilation with -fsanitize=thread option. And there no result at the end of the…
The following minimal example computes the sum of all the numbers from 1 to 1000 and is parallelized with OpenMP:
#include
double sum;
void do_it() {
const size_t n = 1000;
#pragma omp parallel
{
#pragma omp for
for (size_t i =…
When I take a Debug Build of my macOS app, built in Xcode 9.1, and move it to a Mac running macOS 10.11 or 10.12 for testing, I find that my app's XPC process crashes on load, and the crash report indicates the cause is that the system cannot find…
this is a paste from threadsanitazer (clang) which reports data race
http://pastebin.com/93Gw7uPi
Googling around it seems this is a problem with threadsanitazer (for example http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57507)
So lets say this looks…
To check the existence of any threading issue I tried using Thread Sanitiser. But upon enabling it in Edit Scheme my app is crashing as soon as I launch the app. Below is the stack backtrace.
* thread #1, stop reason = signal SIGABRT
* frame #0:…