summaryrefslogtreecommitdiffstats
path: root/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2014-11-14 04:08:45 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2014-11-14 04:08:45 +0000
commit9aba41c82211c1198af8fc2cf6292a22aaab9806 (patch)
tree6a817bce6edb840d4e5c4ad9ebb6f03ba6d7ed77 /clang/test/OpenMP/parallel_for_simd_loop_messages.cpp
parent950a166710db5ca1ff25f8ed5fd2be3c210e1a81 (diff)
downloadbcm5719-llvm-9aba41c82211c1198af8fc2cf6292a22aaab9806.tar.gz
bcm5719-llvm-9aba41c82211c1198af8fc2cf6292a22aaab9806.zip
[OPENMP] Temporary fix for processing of global variables in loops.
Currently there is a bug in processing of global variables used as loop control variables in 'omp for/simd' constructs: these globals must be captured as private variables, but currently they are nor. This is a temporary bug fix for this problem until the correct solution is prepared. If a global var used as lcv without explicit mark as a private/linear/lastprivate the error message is emitted. llvm-svn: 221970
Diffstat (limited to 'clang/test/OpenMP/parallel_for_simd_loop_messages.cpp')
-rw-r--r--clang/test/OpenMP/parallel_for_simd_loop_messages.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp b/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp
index 0185fddfde6..50acb10feed 100644
--- a/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp
+++ b/clang/test/OpenMP/parallel_for_simd_loop_messages.cpp
@@ -11,6 +11,7 @@ public:
static int sii;
#pragma omp threadprivate(sii) // expected-note {{defined as threadprivate or thread local}}
+static int globalii;
int test_iteration_spaces() {
const int N = 100;
@@ -264,6 +265,21 @@ int test_iteration_spaces() {
c[sii] = a[sii];
}
+ {
+// expected-error@+2 {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be a variable with global storage without being explicitly marked as linear}}
+#pragma omp parallel for simd
+ for (globalii = 0; globalii < 10; globalii += 1)
+ c[globalii] = a[globalii];
+ }
+
+ {
+// expected-error@+3 {{loop iteration variable in the associated loop of 'omp parallel for simd' directive may not be a variable with global storage without being explicitly marked as lastprivate}}
+#pragma omp parallel for simd collapse(2)
+ for (ii = 0; ii < 10; ii += 1)
+ for (globalii = 0; globalii < 10; globalii += 1)
+ c[globalii] += a[globalii] + ii;
+ }
+
// expected-error@+2 {{statement after '#pragma omp parallel for simd' must be a for loop}}
#pragma omp parallel for simd
for (auto &item : a) {
OpenPOWER on IntegriCloud