long not supported for #pragma omp for

If I try to compile the following code:

#pragma omp for nowait
for (long i=1; i < size; ++i) {...}

The PGI-Compiler tells me:

PGCC-S-0155-parallel for loop variable must be signed int or char

The OpenMP-specification on the other hand states on page 34 about the type of the variable in a for-loop:

A signed integer variable, of type integer-type, as defined in the base language.

Its very hard to find a definite reference on what an integer-type exactly means for C++ (I don’t own a copy of the standard), but I would be very surprised if long was not one. All other compilers I have tried this with compile it with no problem. I therefore strongly suspect that this is a bug in the PGI-compiler that should be fixed. A little information about what version I have used:

$ pgCC -V
pgCC (aka pgcpp) 6.2-3 64-bit target on x86-64 Linux

Thanks for taking care of this,
Michael


Michael Suess
My blog on parallel programming

Michael: You are on the OpenMP language committee, so you know, as well as I, that we’ve discussed this very issue in the past couple of months. In fact, we have decided that for V3.0, OpenMP will allow any integer type supported by the language as an index for a parallel for © or do (Fortran). The 2.5 standard does not explicitly state that all integer types must be supported.
In any case, PGI is planning to add support for long, long long, short, and unsigned in the next major release of our compilers. We would probably have done so already if anyone outside the language committee had asked for it.
Thanks for the note!

  • Michael Wolfe

Michael, sorry it took me so long to answer, I was away from my computer for the last few days (public holiday in Germany). Actually, the discussions you mention on the language committee have taken place before my time there and from what I had read in the archives I thought they were mainly about unsigned types. But anyways, I just wanted to make sure you guys were aware of the issue and if you are and plan on fixing it, I am one more happy customer :-).


Michael Suess
My blog on parallel programming