From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27747 invoked by alias); 29 Dec 2012 09:33:25 -0000 Received: (qmail 27626 invoked by uid 55); 29 Dec 2012 09:33:00 -0000 From: "dvyukov at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/55561] TSAN: Fortran/OMP yields false positives Date: Sat, 29 Dec 2012 09:33:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dvyukov at google dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg02414.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561 --- Comment #18 from Dmitry Vyukov 2012-12-29 09:32:53 UTC --- On Tue, Dec 25, 2012 at 11:30 PM, Joost.VandeVondele at mat dot ethz.ch wrote: > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561 > > --- Comment #15 from Joost VandeVondele 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.