OpenMP target region inside parallel region causes internal compiler error

While trying to get some benchmark examples for testing the OMPT interface to run on my system, I encountered a small issue when trying to start a target region from inside a parallel and for region.

Take the following code as an example:

int main(void)
    int num_iterations = 100;
    #pragma omp parallel
        #pragma omp for
        for(int i = 0; i < num_iterations; ++i) {
            #pragma omp target teams distribute parallel for nowait
            for(int j = 0; j < 10; ++j){}

Trying to compile this code with NVHPC 23.3 causes the following error message to appear:

> nvc++ -fopenmp -mp=multicore,gpu -Minfo=all error.cpp
NVC++-F-0000-Internal compiler error. targetinfo symbol not found in uplevel struct    1079  (error.cpp: 8)
NVC++/x86-64 Linux 23.3-0: compilation aborted

Both the nowait clause and the num_iterations variable are important to this issue. Exchanging the variable by a constant value or removing the nowait causes the program to compile perfectly fine.

Hi Jan,

I’m not sure if we support nowait in this context as of yet, but even so, the compiler shouldn’t be giving an ICE.

Filed TPR #33521 and sent it to engineering for review.