r255229 - [OPENMP] Fixed processing of predetermined data-sharing attributes

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 10 00:20:58 PST 2015


Author: abataev
Date: Thu Dec 10 02:20:58 2015
New Revision: 255229

URL: http://llvm.org/viewvc/llvm-project?rev=255229&view=rev
Log:
[OPENMP] Fixed processing of predetermined data-sharing attributes
Predetermined data-shared attributes for local variables are now considered as implicit. Also, patch prohibits changin of DSA for static memebers of classes.

Modified:
    cfe/trunk/lib/Sema/SemaOpenMP.cpp
    cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp
    cfe/trunk/test/OpenMP/for_misc_messages.c
    cfe/trunk/test/OpenMP/for_simd_firstprivate_messages.cpp
    cfe/trunk/test/OpenMP/for_simd_misc_messages.c
    cfe/trunk/test/OpenMP/parallel_for_lastprivate_messages.cpp
    cfe/trunk/test/OpenMP/parallel_for_misc_messages.c
    cfe/trunk/test/OpenMP/parallel_for_reduction_messages.cpp
    cfe/trunk/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp
    cfe/trunk/test/OpenMP/parallel_for_simd_reduction_messages.cpp
    cfe/trunk/test/OpenMP/parallel_private_messages.cpp
    cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp
    cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
    cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
    cfe/trunk/test/OpenMP/sections_firstprivate_messages.cpp
    cfe/trunk/test/OpenMP/simd_misc_messages.c
    cfe/trunk/test/OpenMP/single_firstprivate_messages.cpp
    cfe/trunk/test/OpenMP/task_private_messages.cpp
    cfe/trunk/test/OpenMP/taskloop_lastprivate_messages.cpp
    cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_messages.cpp
    cfe/trunk/test/OpenMP/teams_private_messages.cpp
    cfe/trunk/test/OpenMP/teams_reduction_messages.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Thu Dec 10 02:20:58 2015
@@ -565,41 +565,20 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
   }
 
   // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
-  // in a Construct, C/C++, predetermined, p.1]
-  // Variables with automatic storage duration that are declared in a scope
-  // inside the construct are private.
-  OpenMPDirectiveKind Kind =
-      FromParent ? getParentDirective() : getCurrentDirective();
-  auto StartI = std::next(Stack.rbegin());
-  auto EndI = std::prev(Stack.rend());
-  if (FromParent && StartI != EndI) {
-    StartI = std::next(StartI);
-  }
-  if (!isParallelOrTaskRegion(Kind)) {
-    if (isOpenMPLocal(D, StartI) &&
-        ((D->isLocalVarDecl() && (D->getStorageClass() == SC_Auto ||
-                                  D->getStorageClass() == SC_None)) ||
-         isa<ParmVarDecl>(D))) {
-      DVar.CKind = OMPC_private;
+  // in a Construct, C/C++, predetermined, p.4]
+  //  Static data members are shared.
+  // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
+  // in a Construct, C/C++, predetermined, p.7]
+  //  Variables with static storage duration that are declared in a scope
+  //  inside the construct are shared.
+  if (D->isStaticDataMember()) {
+    DSAVarData DVarTemp =
+        hasDSA(D, isOpenMPPrivate, MatchesAlways(), FromParent);
+    if (DVarTemp.CKind != OMPC_unknown && DVarTemp.RefExpr)
       return DVar;
-    }
 
-    // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
-    // in a Construct, C/C++, predetermined, p.4]
-    //  Static data members are shared.
-    // OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
-    // in a Construct, C/C++, predetermined, p.7]
-    //  Variables with static storage duration that are declared in a scope
-    //  inside the construct are shared.
-    if (D->isStaticDataMember()) {
-      DSAVarData DVarTemp =
-          hasDSA(D, isOpenMPPrivate, MatchesAlways(), FromParent);
-      if (DVarTemp.CKind != OMPC_unknown && DVarTemp.RefExpr)
-        return DVar;
-
-      DVar.CKind = OMPC_shared;
-      return DVar;
-    }
+    DVar.CKind = OMPC_shared;
+    return DVar;
   }
 
   QualType Type = D->getType().getNonReferenceType().getCanonicalType();
@@ -626,6 +605,11 @@ DSAStackTy::DSAVarData DSAStackTy::getTo
 
   // Explicitly specified attributes and local variables with predetermined
   // attributes.
+  auto StartI = std::next(Stack.rbegin());
+  auto EndI = std::prev(Stack.rend());
+  if (FromParent && StartI != EndI) {
+    StartI = std::next(StartI);
+  }
   auto I = std::prev(StartI);
   if (I->SharingMap.count(D)) {
     DVar.RefExpr = I->SharingMap[D].RefExpr;

Modified: cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_firstprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -118,7 +118,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;                      // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
-#pragma omp for firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;
@@ -285,7 +285,7 @@ int main(int argc, char **argv) {
   {
     int v = 0;
     int i;                      // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
-#pragma omp for firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp for firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;

Modified: cfe/trunk/test/OpenMP/for_misc_messages.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_misc_messages.c?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_misc_messages.c (original)
+++ cfe/trunk/test/OpenMP/for_misc_messages.c Thu Dec 10 02:20:58 2015
@@ -194,7 +194,7 @@ void test_collapse() {
   for (i = 0; i < 16; ++i)
 // expected-note at +1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
     for (int j = 0; j < 16; ++j)
-// expected-error at +2 {{private variable cannot be reduction}}
+// expected-error at +2 {{reduction variable must be shared}}
 // expected-error at +1 {{region cannot be closely nested inside 'for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
 #pragma omp for reduction(+ : i, j)
       for (int k = 0; k < 16; ++k)

Modified: cfe/trunk/test/OpenMP/for_simd_firstprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_simd_firstprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_simd_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/for_simd_firstprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -122,7 +122,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;                      // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for simd' directive into a parallel or another task region?}}
-#pragma omp for simd firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp for simd firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;
@@ -286,7 +286,7 @@ int main(int argc, char **argv) {
   {
     int v = 0;
     int i;                      // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for simd' directive into a parallel or another task region?}}
-#pragma omp for simd firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp for simd firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;

Modified: cfe/trunk/test/OpenMP/for_simd_misc_messages.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/for_simd_misc_messages.c?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/for_simd_misc_messages.c (original)
+++ cfe/trunk/test/OpenMP/for_simd_misc_messages.c Thu Dec 10 02:20:58 2015
@@ -375,7 +375,7 @@ void test_collapse() {
   for (i = 0; i < 16; ++i)
 // expected-note at +1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for simd' directive into a parallel or another task region?}}
     for (int j = 0; j < 16; ++j)
-// expected-error at +2 {{private variable cannot be reduction}}
+// expected-error at +2 {{reduction variable must be shared}}
 // expected-error at +1 {{OpenMP constructs may not be nested inside a simd region}}
 #pragma omp for simd reduction(+ : i, j)
       for (int k = 0; k < 16; ++k)

Modified: cfe/trunk/test/OpenMP/parallel_for_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_lastprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_lastprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -17,7 +17,7 @@ public:
   S2(S2 &s2) : a(s2.a) {}
   S2 &operator=(const S2 &);
   const S2 &operator=(const S2 &) const;
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
@@ -188,7 +188,7 @@ int main(int argc, char **argv) {
 #pragma omp parallel for lastprivate(xa) // OK
   for (i = 0; i < argc; ++i)
     foo();
-#pragma omp parallel for lastprivate(S2::S2s)
+#pragma omp parallel for lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel for lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}

Modified: cfe/trunk/test/OpenMP/parallel_for_misc_messages.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_misc_messages.c?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_misc_messages.c (original)
+++ cfe/trunk/test/OpenMP/parallel_for_misc_messages.c Thu Dec 10 02:20:58 2015
@@ -165,8 +165,7 @@ void test_collapse() {
   for (i = 0; i < 16; ++i)
 // expected-note at +1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
     for (int j = 0; j < 16; ++j)
-// expected-error at +3 {{reduction variable must be shared}}
-// expected-error at +2 {{private variable cannot be reduction}}
+// expected-error at +2 2 {{reduction variable must be shared}}
 // expected-error at +1 {{region cannot be closely nested inside 'parallel for' region; perhaps you forget to enclose 'omp for' directive into a parallel region?}}
 #pragma omp for reduction(+ : i, j)
       for (int k = 0; k < 16; ++k)

Modified: cfe/trunk/test/OpenMP/parallel_for_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_reduction_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_reduction_messages.cpp Thu Dec 10 02:20:58 2015
@@ -18,7 +18,7 @@ class S2 {
 public:
   S2() : a(0) {}
   S2(S2 &s2) : a(s2.a) {}
-  static float S2s;
+  static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
@@ -141,7 +141,7 @@ T tmain(T argc) {
 #pragma omp parallel for reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   for (int i = 0; i < 10; ++i)
     foo();
-#pragma omp parallel for reduction(&& : S2::S2s)
+#pragma omp parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}
@@ -263,7 +263,7 @@ int main(int argc, char **argv) {
 #pragma omp parallel for reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   for (int i = 0; i < 10; ++i)
     foo();
-#pragma omp parallel for reduction(&& : S2::S2s)
+#pragma omp parallel for reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel for reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}

Modified: cfe/trunk/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_simd_lastprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -16,7 +16,7 @@ public:
   S2() : a(0) {}
   S2(S2 &s2) : a(s2.a) {}
   const S2 &operator=(const S2 &) const;
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
@@ -190,7 +190,7 @@ int main(int argc, char **argv) {
 #pragma omp parallel for simd lastprivate(xa) // OK
   for (i = 0; i < argc; ++i)
     foo();
-#pragma omp parallel for simd lastprivate(S2::S2s)
+#pragma omp parallel for simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel for simd lastprivate(S2::S2sc) // expected-error {{shared variable cannot be lastprivate}}

Modified: cfe/trunk/test/OpenMP/parallel_for_simd_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_for_simd_reduction_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_for_simd_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_for_simd_reduction_messages.cpp Thu Dec 10 02:20:58 2015
@@ -18,7 +18,7 @@ class S2 {
 public:
   S2() : a(0) {}
   S2(S2 &s2) : a(s2.a) {}
-  static float S2s;
+  static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
@@ -141,7 +141,7 @@ T tmain(T argc) {
 #pragma omp parallel for simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   for (int i = 0; i < 10; ++i)
     foo();
-#pragma omp parallel for simd reduction(&& : S2::S2s)
+#pragma omp parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}
@@ -263,7 +263,7 @@ int main(int argc, char **argv) {
 #pragma omp parallel for simd reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   for (int i = 0; i < 10; ++i)
     foo();
-#pragma omp parallel for simd reduction(&& : S2::S2s)
+#pragma omp parallel for simd reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel for simd reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}

Modified: cfe/trunk/test/OpenMP/parallel_private_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_private_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_private_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_private_messages.cpp Thu Dec 10 02:20:58 2015
@@ -13,7 +13,7 @@ class S2 {
   mutable int a;
 public:
   S2():a(0) { }
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
 };
 const S2 b;
 const S2 ba[5];
@@ -69,7 +69,7 @@ int main(int argc, char **argv) {
   #pragma omp parallel private(ba)
   #pragma omp parallel private(ca) // expected-error {{shared variable cannot be private}}
   #pragma omp parallel private(da) // expected-error {{shared variable cannot be private}}
-  #pragma omp parallel private(S2::S2s)
+  #pragma omp parallel private(S2::S2s) // expected-error {{shared variable cannot be private}}
   #pragma omp parallel private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
   #pragma omp parallel private(threadvar, B::x) // expected-error 2 {{threadprivate or thread local variable cannot be private}}
   #pragma omp parallel shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}}

Modified: cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_reduction_messages.cpp Thu Dec 10 02:20:58 2015
@@ -18,7 +18,7 @@ class S2 {
 public:
   S2() : a(0) {}
   S2(S2 &s2) : a(s2.a) {}
-  static float S2s;
+  static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
@@ -121,7 +121,7 @@ T tmain(T argc) {
   foo();
 #pragma omp parallel reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   foo();
-#pragma omp parallel reduction(&& : S2::S2s)
+#pragma omp parallel reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   foo();
 #pragma omp parallel reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}
   foo();
@@ -216,7 +216,7 @@ int main(int argc, char **argv) {
   foo();
 #pragma omp parallel reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   foo();
-#pragma omp parallel reduction(&& : S2::S2s)
+#pragma omp parallel reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   foo();
 #pragma omp parallel reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}
   foo();

Modified: cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_sections_lastprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -16,7 +16,7 @@ public:
   S2() : a(0) {}
   S2(S2 &s2) : a(s2.a) {}
   const S2 &operator=(const S2 &) const;
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
@@ -220,7 +220,7 @@ int main(int argc, char **argv) {
   {
     foo();
   }
-#pragma omp parallel sections lastprivate(S2::S2s)
+#pragma omp parallel sections lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
   {
     foo();
   }

Modified: cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/parallel_sections_reduction_messages.cpp Thu Dec 10 02:20:58 2015
@@ -18,7 +18,7 @@ class S2 {
 public:
   S2() : a(0) {}
   S2(S2 &s2) : a(s2.a) {}
-  static float S2s;
+  static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
@@ -161,7 +161,7 @@ T tmain(T argc) {
   {
     foo();
   }
-#pragma omp parallel sections reduction(&& : S2::S2s)
+#pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   {
     foo();
   }
@@ -314,7 +314,7 @@ int main(int argc, char **argv) {
   {
     foo();
   }
-#pragma omp parallel sections reduction(&& : S2::S2s)
+#pragma omp parallel sections reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   {
     foo();
   }

Modified: cfe/trunk/test/OpenMP/sections_firstprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/sections_firstprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/sections_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/sections_firstprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -135,7 +135,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;                           // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp sections' directive into a parallel or another task region?}}
-#pragma omp sections firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp sections firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     {
       foo();
     }
@@ -322,7 +322,7 @@ int main(int argc, char **argv) {
   {
     int v = 0;
     int i;                           // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp sections' directive into a parallel or another task region?}}
-#pragma omp sections firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp sections firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     {
       foo();
     }

Modified: cfe/trunk/test/OpenMP/simd_misc_messages.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/simd_misc_messages.c?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/simd_misc_messages.c (original)
+++ cfe/trunk/test/OpenMP/simd_misc_messages.c Thu Dec 10 02:20:58 2015
@@ -356,12 +356,18 @@ void test_collapse() {
   for (i = 0; i < 16; ++i)
     // expected-note at +1 {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp for' directive into a parallel or another task region?}}
     for (int j = 0; j < 16; ++j)
-// expected-error at +3 {{reduction variable must be shared}}
-// expected-error at +2 {{private variable cannot be reduction}}
+// expected-error at +2 2 {{reduction variable must be shared}}
 // expected-error at +1 {{OpenMP constructs may not be nested inside a simd region}}
 #pragma omp for reduction(+ : i, j)
       for (int k = 0; k < 16; ++k)
         i += j;
+#pragma omp parallel
+#pragma omp for
+  for (i = 0; i < 16; ++i)
+    for (int j = 0; j < 16; ++j)
+#pragma omp simd reduction(+ : i, j)
+      for (int k = 0; k < 16; ++k)
+        i += j;
 }
 
 void test_linear() {

Modified: cfe/trunk/test/OpenMP/single_firstprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/single_firstprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/single_firstprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/single_firstprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -109,7 +109,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;                         // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp single' directive into a parallel or another task region?}}
-#pragma omp single firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp single firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     foo();
     v += i;
   }
@@ -232,7 +232,7 @@ int main(int argc, char **argv) {
   {
     int v = 0;
     int i;                         // expected-note {{variable with automatic storage duration is predetermined as private; perhaps you forget to enclose 'omp single' directive into a parallel or another task region?}}
-#pragma omp single firstprivate(i) // expected-error {{private variable cannot be firstprivate}}
+#pragma omp single firstprivate(i) // expected-error {{firstprivate variable must be shared}}
     foo();
     v += i;
   }

Modified: cfe/trunk/test/OpenMP/task_private_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/task_private_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/task_private_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/task_private_messages.cpp Thu Dec 10 02:20:58 2015
@@ -14,7 +14,7 @@ class S2 {
 
 public:
   S2() : a(0) {}
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
 };
 const S2 b;
 const S2 ba[5];
@@ -78,7 +78,7 @@ int main(int argc, char **argv) {
 #pragma omp task private(ba)
 #pragma omp task private(ca)           // expected-error {{shared variable cannot be private}}
 #pragma omp task private(da)           // expected-error {{shared variable cannot be private}}
-#pragma omp task private(S2::S2s)
+#pragma omp task private(S2::S2s)      // expected-error {{shared variable cannot be private}}
 #pragma omp task private(e, g)         // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}
 #pragma omp task private(threadvar, B::x)    // expected-error 2 {{threadprivate or thread local variable cannot be private}}
 #pragma omp task shared(i), private(i) // expected-error {{shared variable cannot be private}} expected-note {{defined as shared}}

Modified: cfe/trunk/test/OpenMP/taskloop_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_lastprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/taskloop_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/taskloop_lastprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -17,7 +17,7 @@ public:
   S2(S2 &s2) : a(s2.a) {}
   const S2 &operator =(const S2&) const;
   S2 &operator =(const S2&);
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
@@ -224,7 +224,7 @@ int main(int argc, char **argv) {
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel
-#pragma omp taskloop lastprivate(S2::S2s)
+#pragma omp taskloop lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel

Modified: cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/taskloop_simd_lastprivate_messages.cpp Thu Dec 10 02:20:58 2015
@@ -17,7 +17,7 @@ public:
   S2(S2 &s2) : a(s2.a) {}
   const S2 &operator =(const S2&) const;
   S2 &operator =(const S2&);
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note {{static data member is predetermined as shared}}
@@ -224,7 +224,7 @@ int main(int argc, char **argv) {
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel
-#pragma omp taskloop simd lastprivate(S2::S2s)
+#pragma omp taskloop simd lastprivate(S2::S2s) // expected-error {{shared variable cannot be lastprivate}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp parallel

Modified: cfe/trunk/test/OpenMP/teams_private_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_private_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/teams_private_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_private_messages.cpp Thu Dec 10 02:20:58 2015
@@ -13,7 +13,7 @@ class S2 {
   mutable int a;
 public:
   S2():a(0) { }
-  static float S2s;
+  static float S2s; // expected-note {{static data member is predetermined as shared}}
 };
 const S2 b;
 const S2 ba[5];
@@ -96,7 +96,7 @@ int main(int argc, char **argv) {
   #pragma omp teams private(da) // expected-error {{shared variable cannot be private}}
   foo();
   #pragma omp target
-  #pragma omp teams private(S2::S2s)
+  #pragma omp teams private(S2::S2s) // expected-error {{shared variable cannot be private}}
   foo();
   #pragma omp target
   #pragma omp teams private(e, g) // expected-error {{calling a private constructor of class 'S4'}} expected-error {{calling a private constructor of class 'S5'}}

Modified: cfe/trunk/test/OpenMP/teams_reduction_messages.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/teams_reduction_messages.cpp?rev=255229&r1=255228&r2=255229&view=diff
==============================================================================
--- cfe/trunk/test/OpenMP/teams_reduction_messages.cpp (original)
+++ cfe/trunk/test/OpenMP/teams_reduction_messages.cpp Thu Dec 10 02:20:58 2015
@@ -18,7 +18,7 @@ class S2 {
 public:
   S2() : a(0) {}
   S2(S2 &s2) : a(s2.a) {}
-  static float S2s;
+  static float S2s; // expected-note 2 {{static data member is predetermined as shared}}
   static const float S2sc;
 };
 const float S2::S2sc = 0; // expected-note 2 {{'S2sc' defined here}}
@@ -142,7 +142,7 @@ T tmain(T argc) {
 #pragma omp teams reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   foo();
 #pragma omp target
-#pragma omp teams reduction(&& : S2::S2s)
+#pragma omp teams reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   foo();
 #pragma omp target
 #pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}
@@ -270,7 +270,7 @@ int main(int argc, char **argv) {
 #pragma omp teams reduction(^ : fl) // expected-error {{invalid operands to binary expression ('float' and 'float')}}
   foo();
 #pragma omp target
-#pragma omp teams reduction(&& : S2::S2s)
+#pragma omp teams reduction(&& : S2::S2s) // expected-error {{shared variable cannot be reduction}}
   foo();
 #pragma omp target
 #pragma omp teams reduction(&& : S2::S2sc) // expected-error {{const-qualified list item cannot be reduction}}




More information about the cfe-commits mailing list