This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug sanitizer/55561] TSAN crashes for Fortran
- From: "Joost.VandeVondele at mat dot ethz.ch" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 10 Dec 2012 15:55:50 +0000
- Subject: [Bug sanitizer/55561] TSAN crashes for Fortran
- Auto-submitted: auto-generated
- References: <bug-55561-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55561
--- Comment #13 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> 2012-12-10 15:55:50 UTC ---
(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. Something like this is supposed to be OK
OMP-wise (and gives the right result in 10000 repetitions) but produces
warnings.
> cat test.f90
INTEGER, PARAMETER :: N=10
INTEGER :: data(N)
!$OMP PARALLEL DO
DO j=1,N
data(j)=j
ENDDO
!$OMP PARALLEL DO
DO j=N,1,-1
data(j)=data(j)-j
ENDDO
IF (ANY(data.NE.0)) CALL abort()
END
> gfortran -fsanitize=thread -O1 -g -fopenmp -fPIC -pie test.f90 ; ./a.out
==================
WARNING: ThreadSanitizer: data race (pid=18871)
> However, most likely Fortran/OpenMP will require some special handling to
> produce better reports and catch more bugs (ThreadSanitizer reasons about
> synchronization on pthread level, and not on OpenMP level). We won't have spare
> cycles for that in near future.
> I am working on ThreadSanitizer tasking API, I would appreciate if you review
> it and comment on whether it will fit Fortran/OpenMP model (the work is
> currently in very early "what if" stage).
I'm sure there are knowledgeable people reading the gcc list... posting this
text there seems like a good idea.