I believe I have run across a bug in the PGI Fortran compiler involving OpenMP and the COLLAPSE directive. The latest pgfortran I have access to is 12.4, and it fails for me. I have packaged up a test case illustrating the problem; it’s a little too long to post here but can be obtained via
“wget http://people.nas.nasa.gov/jesperse/ssortest.tar.gz”
if you’re interested. That file (3 KB) has a README, Makefile, and source code. If you want the file but have trouble getting it, e-mail me and I can probably sent it to you.
I had an OpenMP guru here look at the example, and he thinks it’s OK. Also, the GNU Fortran and Intel Fortran compilers don’t have any problem with it.