[Bug fortran/79247] New: Race condition on OpenMP reduction variable
paul.k.romano at gmail dot com
gcc-bugzilla@gcc.gnu.org
Thu Jan 26 19:32:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79247
Bug ID: 79247
Summary: Race condition on OpenMP reduction variable
Product: gcc
Version: 6.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: paul.k.romano at gmail dot com
Target Milestone: ---
The following program results in a race condition on x:
program main
integer :: i, x = 0
!$omp parallel do reduction(+:x)
do i = 1, 100000
call accumulate()
end do
!$omp end parallel do
print *, x
contains
subroutine accumulate()
x = x + 1
end subroutine accumulate
end program main
As far as I can tell, this is permitted by the OpenMP standard. If one
explicitly passes x to the subroutine, the race condition disappears. It's also
worth noting that with Intel Fortran (17.0.1), no race condition occurs and the
correct value of 100000 is printed.
I am using gcc 6.2.0 from the system packages on Ubuntu 16.10.
More information about the Gcc-bugs
mailing list