-A on NVHPC > 23.1 with -stdpar gives header error


The following program:

// nvcxx_a_bad.cpp
#include <algorithm>
#include <execution>
int main() { return 0; }

Gives the following:

/opt/nvidia/hpc_sdk/Linux_x86_64/23.1/compilers/bin/nvc++  -stdpar -A nvcxx_a_bad.cpp // OK


/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/compilers/bin/nvc++  -stdpar -A nvcxx_a_bad.cpp                                                                                                                
"/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/compilers/include-stdpar/cuda/std/detail/libcxx/include/chrono", line 3158: error: too few arguments in function call
      static unsigned constexpr fractional_width = __width(__CommonType::period::den) < 19 ?

"/opt/nvidia/hpc_sdk/Linux_x86_64/23.3/compilers/include-stdpar/cuda/std/detail/libcxx/include/chrono", line 3159: error: too few arguments in function call
                                                   __width(__CommonType::period::den) : 6u;

2 errors detected in the compilation of "nvcxx_a_bad.cpp"

We get the same error on 23.5 and 23.7 as well.
We’ve tested this with GCC 11 and GCC 12 and verified that PGI (or what’s left of it) did select the correct C++ stdlib via -v.

Removing -A or removing -stdpar resolves the issue.
Here, -A was added by CMake if we request -DCMAKE_CXX_EXTENSIONS=OFF which is useful for writing ISO conformant code.
Interestingly, --c++20 -stdpar -A nvcxx_a_bad.cpp gives the same error but --c++20 -stdpar nvcxx_a_bad.cpp works.
My understanding is that --c++XX should imply -A.

Hi Tom,

Yes, the strict standard compliance flag, “-A”, can be problematic at times. In this case, the problem header is coming from the CUDA libc++ so not under my team’s direct control. However, we do report these issues as they are found.

I’m still seeing the issue in our upcoming 23.9 release, but it does not reproduce in our development compiler. Hence, it should fixed in a future release.