[Bug fortran/99529] libgfortran I/O: Data races related to new unit / new unit calls for I/O to strings

mscfd at gmx dot net gcc-bugzilla@gcc.gnu.org
Thu Mar 11 08:52:06 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99529

--- Comment #3 from martin <mscfd at gmx dot net> ---
Thanks for looking at the report and providing a patch to test.
For completeness sake, here is the simple test code, which does not fail, but
which shows the data race in helgrind (compile with -fopenmp -g2):

program omp_write_str

use OMP_LIB
implicit none

integer :: i
character(len=16) :: out

!$omp parallel do schedule(static,10) default(shared) private(i, out)
do i=1,100000
   write(out,'(i8)') omp_get_thread_num()
end do
!$omp end parallel do

end program omp_write_str


The provided patch indeed removes the data races (there are still data races at
startup and exit, which are false positives, as those occur in a single
threaded region.)

However, with the my real code, it does not help. I will further check with
helgrind (the amount of false positives is staggering, though...)


More information about the Gcc-bugs mailing list