It seems you have a serious bug in your collapse openmp statements.
I did this small code:
module fail_m implicit none contains subroutine zero(n, Dk) integer :: n real :: Dk(2,n,n) integer :: i, j !$OMP parallel do default(shared), collapse(2), private(i,j) do j = 1, n do i = 1, n Dk(1,i,j) = 0. Dk(2,i,j) = 0. end do end do !$OMP end parallel do end subroutine zero end module fail_m program test use fail_m integer, parameter :: n = 200 real :: Dk(2,n,n) call random_number(Dk) call zero(n, Dk) print '(f10.4)', sum(Dk) end program test
and ran for multiple different versions.
In all cases the program should print out 0.0000. However, for all 2019.X versions it prints something else.
Here is a complete list of the versions I have tested (and whether they failed or succeeded).
Failed: 2019.0.117 = 29939.7344
Failed: 2019.1.144 = 29939.7344
Failed: 2019.2.187 = 29939.7344
Failed: 2019.3.199 = 29939.7344
I need not say how severe this is :(
I see that on 2019.5.281 it gives the wrong result with -O2 or -O3 but gives zero for -O0 and -O1. Looks like it may be caused by a conflict with openmp collapse and unrolling.