Possible compiler bug with OpenMP and COLLAPSE directive

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.

Thanks Dennis,

I was able to recreate the issue here and have sent a report to our engineers (TPR#18707) for further investigation. As you note in your Makefile, the test is successful without optimization.

Best Regards,


TPR 18707 - User code gets wrong answers with OpenMP COLLAPSE

was fixed as of the 13.1 release.

Thanks for the report.