Hi,
The program below exits with "error" on my machine. It looks as if the variable r in the block is shared by the openmp loop, but it surely shouldn't be?
Thank you,
UM
program mfort implicit none integer :: i real :: x(1000)=[(i,i=1,1000)], y(1000) !$omp parallel do do i=1,1000 call sub(x(i),y(i)) enddo contains subroutine sub(x,y) real :: x,y,z integer :: i block real :: r r=x z=0 do i=1,1000 z=z+cos(real(i)) ! waste some time enddo if(r .ne. x) then print *,"error" stop endif y=r+z end block end subroutine end program