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

            Bug ID: 125367
           Summary: [OpenMP] Missing diagnostic for list item in both map
                    and private clauses
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: parras at gcc dot gnu.org
  Target Milestone: ---

Consider the following source code:

void f() {
int x, y;
#pragma omp target private(y) map(tofrom:x,y) 
  ;
#pragma omp target firstprivate(x) map(tofrom:x,y) 
  ;
}

This gives the two expected errors for both PRIVATE and FIRSTPRIVATE:

error: 'y' appears both in data and map clauses
    3 | #pragma omp target private(y) map(tofrom:x,y)
      |                           ^
error: 'x' appears both in data and map clauses
    5 | #pragma omp target firstprivate(x) map(tofrom:x,y)
      |                                ^

However, if we reverse the order of clauses:

void f() {
int x, y;
#pragma omp target map(tofrom:x,y) private(y)
  ;
#pragma omp target map(tofrom:x,y) firstprivate(x)
  ;
} 

Then we only get the error for FIRSTPRIVATE:

error: ‘x’ appears both in data and map clauses
    5 | #pragma omp target map(tofrom:x,y) firstprivate(x) 

The error for PRIVATE is missing.

Reply via email to