[Bug sanitizer/55561] TSAN: Fortran/OMP yields false positives
dvyukov at google dot com
gcc-bugzilla@gcc.gnu.org
Sat Dec 29 09:33:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561
--- Comment #18 from Dmitry Vyukov <dvyukov at google dot com> 2012-12-29 09:32:53 UTC ---
On Tue, Dec 25, 2012 at 11:30 PM, Joost.VandeVondele at mat dot
ethz.ch <gcc-bugzilla@gcc.gnu.org> wrote:
>
> 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.
Good idea!
It should do for now. It should eliminate all false positives since
tsan must understand synchronization in libgomp (pthread, __sync).
It can have false negatives, though. E.g. all gomp_iter_dynamic_next()
synchronize with each other.
>
> 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
>
> --
> Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug.
More information about the Gcc-bugs
mailing list