pgf95 and OpenMP problem (bug?)


Is there any problem/issue I should be aware of when using intrinsic functions with OpenMP in pgf95?
I would expect the code below to print 1000 identical numbers, and it works correctly with ifort and gfortran, but with pgf95 and OpenMP on a few elements come out as zeros. Sequential code works fine on all compilers.

The compiler version is pgf95 11.2-1 64-bit target on x86-64 Linux -tp shanghai

program test
integer, parameter :: N=10, T=1000
integer :: iii(1)
real :: x(N), F(N), mF(T)

do i=1,N
  x(i) = N/2.-N
end do

!$omp parallel do default(private) shared(x,mF)
do it=1,T
  F = x
  iii = maxloc(F)
  mF(it) = F(iii(1))
end do
!$omp end parallel do

write(*,*) mF

end program test


Hi laxxy,

Thanks for the report. I was able to recreate the problem and have send a report to our engineers (TPR#17775) for further review.

As a work around, you can put a critical section around the call to maxloc. I also was able to get correct answers if I set the DIM argument to one, i.e. “iii = maxloc(F,1)”, though I’m not positive if this is just ‘luck’ or an valid solution.

  • Mat

Thanks a lot Mat!

BTW, is there any way to check if it’s been fixed?

We typically get things fixed within one of two minor releases of the report depending upon where we are in the release cycle as well as the severity of the issue. Once fixed, we will post on this thread that it has been fixed.

You can also send a note to PGI Customer Server ( and ask to be put on the notification list for TPR#17775.


Sorry for the late response.