http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561
--- Comment #15 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> 2012-12-25 19:30:15 UTC --- (In reply to comment #13) > (In reply to comment #12) > > That's great that gcc tsan works for Fortran/OpenMP out of the box! > > I'm afraid it yields false positives. The obvious solution to this seems to be that also the OMP runtime (libgomp) must be compiled with -fsanitize=thread. If I do that, it appears to work. That's cool, I will try to do some more testing. A reasonable approach could be to build two versions of libgomp. One standard one, and one sanitized one (libgomp_tsan ?). -fsanitize=thread -fopenmp could link the second version automatically. Just for those trying this out... I used the following to build&install a sanitized libgomp (based on Jakub's comments in PR55374 and a hack of mine (-L...)) after an initial normal build cd /data/vjoost/gnu/gcc_trunk/obj/x86_64-unknown-linux-gnu/libgomp/ make clean make CFLAGS="-std=gnu99 -g -O2 -fsanitize=thread" FCFLAGS="-g -O2 -fsanitize=thread" LDFLAGS="-L/data/vjoost/gnu/gcc_trunk/obj/x86_64-unknown-linux-gnu/libsanitizer/tsan/.libs/ -B/data/vjoost/gnu/gcc_trunk/obj/x86_64-unknown-linux-gnu/libsanitizer/tsan/.libs/ -Wl,-rpath,/data/vjoost/gnu/gcc_trunk/obj/x86_64-unknown-linux-gnu/libsanitizer/tsan/.libs/ -fsanitize=thread" cd /data/vjoost/gnu/gcc_trunk/obj/ make install compilation as gfortran -fopenmp -fsanitize=thread -pie -fPIC test.f90