Here's a reproducer:
program bug
implicit none
integer :: i, j
i = 0
j = 0
!$omp parallel shared(i)
!$omp sections
do i=1,10
j = j + i
end do
!$omp end sections
!$omp end parallel
print *, "i: ", i
if ( i==11 ) then
print *,'ok'
else
print *,'fail, i: ', i
end if
end program
When I compile this program with the -fopenmp option and execute it, I get the output:
When similarly compiled with gfortran and executed, I get: