https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96678

            Bug ID: 96678
           Summary: [OpenMP] Rejects map(var[:]) of known size with "for
                    pointer type length expression must be specified"
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: openmp, rejects-valid
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

The following seems to work with many OpenMP compilers and seems to valid. With
GCC 11:

# g++ -fopenmp -c -DEXPLICIT_SIZE test.c 

# g++ -fopenmp -c -UEXPLICIT_SIZE test.c 
test6.c: In function ‘void test(double*)’:
test6.c:9:34: error: for pointer type length expression must be specified
    9 |     #pragma omp target map(alloc:src[:])
      |                                  ^~~

// ----------- test.c ----------
#define SIZE   (100)
typedef double Grid[SIZE];

void test (Grid src)
{
  #ifdef EXPLICIT_SIZE
    #pragma omp target map(alloc:src[0:SIZE])
  #else
    #pragma omp target map(alloc:src[:])
  #endif
  {
    src[0] = 5;
  }
}

Reply via email to