Thread-local pointers array initialization ignored in OpenMP parallel region

Hi.

I noticed that the following program, compiled with nvc -mp=multicore
fails the assertion.

#include <omp.h>
#include <stdio.h>
#include <assert.h>
int main()
{
        #pragma omp parallel 
        {
                int*a[] = {NULL};
                assert(a[0]==NULL);                                                                                                         
        }       
}


It seems like the initialization of the thread-local pointers array is not working.
Noticed with nvc-22.9 and nvc-23.1 for Linux_x86_64.

Thanks for the report michelemartone. I created a problem report, TPR #33217, and sent it to engineering for investigation.

-Mat

Hi michelemartone,

While engineering is still working on TPR #33217, they have provided the following work around:

% cat test.c
#include <omp.h>
#include <stdio.h>
#include <assert.h>
int main()
{
        #pragma omp parallel
        {
                int a[] = {0};
                assert(a[0]==0);
        }
}
% nvc -mp=multicore test.c
% env OMP_NUM_THREADS=2 ./a.out
%

-Mat