OSDN Git Service

[OPENMP50]Perform data mapping analysis only for explicitly mapped data.
authorAlexey Bataev <a.bataev@hotmail.com>
Tue, 7 Jul 2020 20:16:17 +0000 (16:16 -0400)
committerAlexey Bataev <a.bataev@hotmail.com>
Mon, 20 Jul 2020 17:01:15 +0000 (13:01 -0400)
Summary:
According to OpenMP 5.0, the restrictions for mapping of overlapped data
apply only for explicitly mapped data, there is no restriction for
implicitly mapped data just like in OpenMP 4.5.

Reviewers: jdoerfert

Subscribers: yaxunl, guansong, sstefan1, cfe-commits, caomhin

Tags: #clang

Differential Revision: https://reviews.llvm.org/D83398

clang/lib/Sema/SemaOpenMP.cpp
clang/test/OpenMP/target_map_messages.cpp

index 1e7d432..3c9fdbd 100644 (file)
@@ -17484,6 +17484,7 @@ static void checkMappableExpressionList(
                           /*CurrentRegionOnly=*/true, CurComponents, CKind))
       break;
     if (CKind == OMPC_map &&
+        (SemaRef.getLangOpts().OpenMP <= 45 || StartLoc.isValid()) &&
         checkMapConflicts(SemaRef, DSAS, CurDeclaration, SimpleExpr,
                           /*CurrentRegionOnly=*/false, CurComponents, CKind))
       break;
index 833f509..df6591d 100644 (file)
@@ -604,6 +604,7 @@ int main(int argc, char **argv) {
   const int (&l)[5] = da;
   SC1 s;
   SC1 *p;
+  int Arr[10];
 #pragma omp target data map // expected-error {{expected '(' after 'map'}} le45-error {{expected at least one 'map' or 'use_device_ptr' clause for '#pragma omp target data'}} le50-error {{expected at least one 'map', 'use_device_ptr', or 'use_device_addr' clause for '#pragma omp target data'}}
 #pragma omp target data map( // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expected expression}}
 #pragma omp target data map() // expected-error {{expected expression}}
@@ -750,6 +751,12 @@ int main(int argc, char **argv) {
 #pragma omp target map(iarr[:2:d]) // expected-error {{expected ']'}} expected-note {{to match this '['}}
   {}
 
+#pragma omp target data map(Arr[0:4]) // le45-note {{used here}}
+  {
+#pragma omp target
+    Arr[0] = 2; // le45-error {{original storage of expression in data environment is shared but data environment do not fully contain mapped expression storage}}
+  }
+
   return tmain<int, 3>(argc)+tmain<from, 4>(argc); // expected-note {{in instantiation of function template specialization 'tmain<int, 3>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<int, 4>' requested here}}
 }
 #endif