]> granicus.if.org Git - clang/commitdiff
[OPENMP]Add support for analysis of firstprivate variables.
authorAlexey Bataev <a.bataev@hotmail.com>
Mon, 22 Jul 2019 13:51:07 +0000 (13:51 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Mon, 22 Jul 2019 13:51:07 +0000 (13:51 +0000)
Summary:
Firstprivate variables are the variables, for which the private copies
must be created in the OpenMP regions and must be initialized with the
original values. Thus, we must report if the uninitialized variable is
used as firstprivate.

Reviewers: NoQ

Subscribers: guansong, jdoerfert, caomhin, kkwli0, cfe-commits

Tags: #clang

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@366689 91177308-0d34-0410-b5e6-96231b3b80d8

26 files changed:
include/clang/AST/OpenMPClause.h
test/Analysis/cfg-openmp.cpp
test/OpenMP/distribute_parallel_for_firstprivate_messages.cpp
test/OpenMP/distribute_parallel_for_simd_firstprivate_messages.cpp
test/OpenMP/parallel_firstprivate_messages.cpp
test/OpenMP/parallel_for_firstprivate_messages.cpp
test/OpenMP/parallel_for_simd_firstprivate_messages.cpp
test/OpenMP/parallel_sections_firstprivate_messages.cpp
test/OpenMP/target_firstprivate_messages.cpp
test/OpenMP/target_parallel_firstprivate_messages.cpp
test/OpenMP/target_parallel_for_firstprivate_messages.cpp
test/OpenMP/target_parallel_for_simd_firstprivate_messages.cpp
test/OpenMP/target_simd_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp
test/OpenMP/target_teams_firstprivate_messages.cpp
test/OpenMP/task_firstprivate_messages.cpp
test/OpenMP/taskloop_firstprivate_messages.cpp
test/OpenMP/taskloop_simd_firstprivate_messages.cpp
test/OpenMP/teams_distribute_firstprivate_messages.cpp
test/OpenMP/teams_distribute_parallel_for_firstprivate_messages.cpp
test/OpenMP/teams_distribute_parallel_for_simd_firstprivate_messages.cpp
test/OpenMP/teams_distribute_simd_firstprivate_messages.cpp
test/OpenMP/teams_firstprivate_messages.cpp

index eadcc62a34575d01ecb54ea4a67ebb762dfa3096..9f886ccfbd18a39e1115274dc41125c7d6185fc5 100644 (file)
@@ -2099,10 +2099,12 @@ public:
   }
 
   child_range used_children() {
-    return child_range(child_iterator(), child_iterator());
+    return child_range(reinterpret_cast<Stmt **>(varlist_begin()),
+                       reinterpret_cast<Stmt **>(varlist_end()));
   }
   const_child_range used_children() const {
-    return const_child_range(const_child_iterator(), const_child_iterator());
+    auto Children = const_cast<OMPFirstprivateClause *>(this)->used_children();
+    return const_child_range(Children.begin(), Children.end());
   }
 
   static bool classof(const OMPClause *T) {
index dd417bf408c8f124c4462bd1054d0d7ddb6a3dc6..9e2476eda1e869836e65740ff97a46445a4e15a8 100644 (file)
@@ -5,7 +5,8 @@ void xxx(int argc) {
 // CHECK:        [B1]
 // CHECK-NEXT:   1: int x;
 // CHECK-NEXT:   2: int cond;
-  int x, cond;
+// CHECK-NEXT:   3: int fp;
+  int x, cond, fp;
 // CHECK-NEXT:   [[#ATOM:]]: x
 // CHECK-NEXT:   [[#ATOM+1]]: [B1.[[#ATOM]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:   [[#ATOM+2]]: argc
@@ -29,10 +30,11 @@ void xxx(int argc) {
 // CHECK-NEXT:  [[#DPF+4]]: cond
 // CHECK-NEXT:  [[#DPF+5]]: [B1.[[#DPF+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#DPF+6]]: [B1.[[#DPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#DPF+7]]: #pragma omp distribute parallel for if(parallel: cond)
+// CHECK-NEXT:  [[#DPF+7]]: fp
+// CHECK-NEXT:  [[#DPF+8]]: #pragma omp distribute parallel for if(parallel: cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#DPF+3]]];
-#pragma omp distribute parallel for if(parallel:cond)
+#pragma omp distribute parallel for if(parallel:cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
 // CHECK-NEXT:  [[#DPFS:]]: x
@@ -42,10 +44,11 @@ void xxx(int argc) {
 // CHECK-NEXT:  [[#DPFS+4]]: cond
 // CHECK-NEXT:  [[#DPFS+5]]: [B1.[[#DPFS+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#DPFS+6]]: [B1.[[#DPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#DPFS+7]]: #pragma omp distribute parallel for simd if(cond)
+// CHECK-NEXT:  [[#DPFS+7]]: fp
+// CHECK-NEXT:  [[#DPFS+8]]: #pragma omp distribute parallel for simd if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#DPFS+3]]];
-#pragma omp distribute parallel for simd if(cond)
+#pragma omp distribute parallel for simd if(cond)  firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
 // CHECK-NEXT:  [[#DS:]]: x
@@ -107,10 +110,11 @@ void xxx(int argc) {
 // CHECK-NEXT:  [[#PF+4]]: cond
 // CHECK-NEXT:  [[#PF+5]]: [B1.[[#PF+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#PF+6]]: [B1.[[#PF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#PF+7]]: #pragma omp parallel for if(cond)
+// CHECK-NEXT:  [[#PF+7]]: fp
+// CHECK-NEXT:  [[#PF+8]]: #pragma omp parallel for if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#PF+3]]];
-#pragma omp parallel for if(cond)
+#pragma omp parallel for if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
 // CHECK-NEXT:  [[#PFS:]]: x
@@ -120,10 +124,11 @@ void xxx(int argc) {
 // CHECK-NEXT:  [[#PFS+4]]: cond
 // CHECK-NEXT:  [[#PFS+5]]: [B1.[[#PFS+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#PFS+6]]: [B1.[[#PFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#PFS+7]]: #pragma omp parallel for simd if(cond)
+// CHECK-NEXT:  [[#PFS+7]]: fp
+// CHECK-NEXT:  [[#PFS+8]]: #pragma omp parallel for simd if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#PFS+3]]];
-#pragma omp parallel for simd if(cond)
+#pragma omp parallel for simd if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
 // CHECK-NEXT:  [[#PAR:]]: x
@@ -133,9 +138,10 @@ void xxx(int argc) {
 // CHECK-NEXT:  [[#PAR+4]]: cond
 // CHECK-NEXT:  [[#PAR+5]]: [B1.[[#PAR+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#PAR+6]]: [B1.[[#PAR+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#PAR+7]]: #pragma omp parallel if(cond)
+// CHECK-NEXT:  [[#PAR+7]]: fp
+// CHECK-NEXT:  [[#PAR+8]]: #pragma omp parallel if(cond) firstprivate(fp)
 // CHECK-NEXT:    [B1.[[#PAR+3]]];
-#pragma omp parallel if(cond)
+#pragma omp parallel if(cond) firstprivate(fp)
   argc = x;
 // CHECK-NEXT:  [[#PSECT:]]: x
 // CHECK-NEXT:  [[#PSECT+1]]: [B1.[[#PSECT]]] (ImplicitCastExpr, LValueToRValue, int)
@@ -144,11 +150,12 @@ void xxx(int argc) {
 // CHECK-NEXT:  [[#PSECT+4]]: cond
 // CHECK-NEXT:  [[#PSECT+5]]: [B1.[[#PSECT+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#PSECT+6]]: [B1.[[#PSECT+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#PSECT+7]]: #pragma omp parallel sections if(cond)
+// CHECK-NEXT:  [[#PSECT+7]]: fp
+// CHECK-NEXT:  [[#PSECT+8]]: #pragma omp parallel sections if(cond) firstprivate(fp)
 // CHECK-NEXT:    {
 // CHECK-NEXT:        [B1.[[#PSECT+3]]];
 // CHECK-NEXT:    }
-#pragma omp parallel sections if(cond)
+#pragma omp parallel sections if(cond) firstprivate(fp)
   {
     argc = x;
   }
@@ -170,146 +177,190 @@ void xxx(int argc) {
 // CHECK-NEXT:    [B1.[[#SINGLE+3]]];
 #pragma omp single
   argc = x;
-// CHECK-NEXT:  [[#TARGET:]]: x
-// CHECK-NEXT:  [[#TARGET+1]]: [B1.[[#TARGET]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TARGET+2]]: argc
-// CHECK-NEXT:  [[#TARGET+3]]: [B1.[[#TARGET+2]]] = [B1.[[#TARGET+1]]]
+// CHECK-NEXT:  [[#TARGET:]]:
+// CHECK-SAME:  [B1.[[#TARGET+9]]]
+// CHECK-NEXT:  [[#TARGET+1]]: [B1.[[#TARGET+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TARGET+2]]: [B1.[[#TARGET+8]]]
+// CHECK-NEXT:  [[#TARGET+3]]: [B1.[[#TARGET+8]]] = [B1.[[#TARGET+1]]]
 // CHECK-NEXT:  [[#TARGET+4]]: cond
 // CHECK-NEXT:  [[#TARGET+5]]: [B1.[[#TARGET+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TARGET+6]]: [B1.[[#TARGET+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TARGET+7]]: #pragma omp target depend(in : argc) if(cond)
+// CHECK-NEXT:  [[#TARGET+7]]: fp
+// CHECK-NEXT:  [[#TARGET+8]]: argc
+// CHECK-NEXT:  [[#TARGET+9]]: x
+// CHECK-NEXT:  [[#TARGET+10]]: #pragma omp target depend(in : argc) if(cond) firstprivate(fp)
 // CHECK-NEXT:    [B1.[[#TARGET+3]]];
 #pragma omp target depend(in \
-                          : argc) if(cond)
+                          : argc) if(cond) firstprivate(fp)
   argc = x;
-// CHECK-NEXT:  [[#TPF:]]: x
-// CHECK-NEXT:  [[#TPF+1]]: [B1.[[#TPF]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TPF+2]]: argc
-// CHECK-NEXT:  [[#TPF+3]]: [B1.[[#TPF+2]]] = [B1.[[#TPF+1]]]
+// CHECK-NEXT:  [[#TPF:]]:
+// CHECK-SAME:  [B1.[[#TPF+9]]]
+// CHECK-NEXT:  [[#TPF+1]]: [B1.[[#TPF+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TPF+2]]: [B1.[[#TPF+8]]]
+// CHECK-NEXT:  [[#TPF+3]]: [B1.[[#TPF+8]]] = [B1.[[#TPF+1]]]
 // CHECK-NEXT:  [[#TPF+4]]: cond
 // CHECK-NEXT:  [[#TPF+5]]: [B1.[[#TPF+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TPF+6]]: [B1.[[#TPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TPF+7]]: #pragma omp target parallel for if(parallel: cond)
+// CHECK-NEXT:  [[#TPF+7]]: fp
+// CHECK-NEXT:  [[#TPF+8]]: argc
+// CHECK-NEXT:  [[#TPF+9]]: x
+// CHECK-NEXT:  [[#TPF+10]]: #pragma omp target parallel for if(parallel: cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TPF+3]]];
-#pragma omp target parallel for if(parallel:cond)
+#pragma omp target parallel for if(parallel:cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TPFS:]]: x
-// CHECK-NEXT:  [[#TPFS+1]]: [B1.[[#TPFS]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TPFS+2]]: argc
-// CHECK-NEXT:  [[#TPFS+3]]: [B1.[[#TPFS+2]]] = [B1.[[#TPFS+1]]]
+// CHECK-NEXT:  [[#TPFS:]]:
+// CHECK-SAME:  [B1.[[#TPFS+9]]]
+// CHECK-NEXT:  [[#TPFS+1]]: [B1.[[#TPFS+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TPFS+2]]: [B1.[[#TPFS+8]]]
+// CHECK-NEXT:  [[#TPFS+3]]: [B1.[[#TPFS+8]]] = [B1.[[#TPFS+1]]]
 // CHECK-NEXT:  [[#TPFS+4]]: cond
 // CHECK-NEXT:  [[#TPFS+5]]: [B1.[[#TPFS+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TPFS+6]]: [B1.[[#TPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TPFS+7]]: #pragma omp target parallel for simd if(target: cond)
+// CHECK-NEXT:  [[#TPFS+7]]: fp
+// CHECK-NEXT:  [[#TPFS+8]]: argc
+// CHECK-NEXT:  [[#TPFS+9]]: x
+// CHECK-NEXT:  [[#TPFS+10]]: #pragma omp target parallel for simd if(target: cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TPFS+3]]];
-#pragma omp target parallel for simd if(target:cond)
+#pragma omp target parallel for simd if(target:cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TP:]]: x
-// CHECK-NEXT:  [[#TP+1]]: [B1.[[#TP]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TP+2]]: argc
-// CHECK-NEXT:  [[#TP+3]]: [B1.[[#TP+2]]] = [B1.[[#TP+1]]]
+// CHECK-NEXT:  [[#TP:]]:
+// CHECK-SAME:  [B1.[[#TP+9]]]
+// CHECK-NEXT:  [[#TP+1]]: [B1.[[#TP+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TP+2]]: [B1.[[#TP+8]]]
+// CHECK-NEXT:  [[#TP+3]]: [B1.[[#TP+8]]] = [B1.[[#TP+1]]]
 // CHECK-NEXT:  [[#TP+4]]: cond
 // CHECK-NEXT:  [[#TP+5]]: [B1.[[#TP+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TP+6]]: [B1.[[#TP+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TP+7]]: #pragma omp target parallel if(cond)
+// CHECK-NEXT:  [[#TP+7]]: fp
+// CHECK-NEXT:  [[#TP+8]]: argc
+// CHECK-NEXT:  [[#TP+9]]: x
+// CHECK-NEXT:  [[#TP+10]]: #pragma omp target parallel if(cond) firstprivate(fp)
 // CHECK-NEXT:    [B1.[[#TP+3]]];
-#pragma omp target parallel if(cond)
+#pragma omp target parallel if(cond) firstprivate(fp)
   argc = x;
-// CHECK-NEXT:  [[#TSIMD:]]: x
-// CHECK-NEXT:  [[#TSIMD+1]]: [B1.[[#TSIMD]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TSIMD+2]]: argc
-// CHECK-NEXT:  [[#TSIMD+3]]: [B1.[[#TSIMD+2]]] = [B1.[[#TSIMD+1]]]
+// CHECK-NEXT:  [[#TSIMD:]]:
+// CHECK-SAME:  [B1.[[#TSIMD+9]]]
+// CHECK-NEXT:  [[#TSIMD+1]]: [B1.[[#TSIMD+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TSIMD+2]]: [B1.[[#TSIMD+8]]]
+// CHECK-NEXT:  [[#TSIMD+3]]: [B1.[[#TSIMD+8]]] = [B1.[[#TSIMD+1]]]
 // CHECK-NEXT:  [[#TSIMD+4]]: cond
 // CHECK-NEXT:  [[#TSIMD+5]]: [B1.[[#TSIMD+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TSIMD+6]]: [B1.[[#TSIMD+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TSIMD+7]]: #pragma omp target simd if(cond)
+// CHECK-NEXT:  [[#TSIMD+7]]: fp
+// CHECK-NEXT:  [[#TSIMD+8]]: argc
+// CHECK-NEXT:  [[#TSIMD+9]]: x
+// CHECK-NEXT:  [[#TSIMD+10]]: #pragma omp target simd if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TSIMD+3]]];
-#pragma omp target simd if(cond)
+#pragma omp target simd if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TTD:]]: x
-// CHECK-NEXT:  [[#TTD+1]]: [B1.[[#TTD]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TTD+2]]: argc
-// CHECK-NEXT:  [[#TTD+3]]: [B1.[[#TTD+2]]] = [B1.[[#TTD+1]]]
+// CHECK-NEXT:  [[#TTD:]]:
+// CHECK-SAME:  [B1.[[#TTD+9]]]
+// CHECK-NEXT:  [[#TTD+1]]: [B1.[[#TTD+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TTD+2]]: [B1.[[#TTD+8]]]
+// CHECK-NEXT:  [[#TTD+3]]: [B1.[[#TTD+8]]] = [B1.[[#TTD+1]]]
 // CHECK-NEXT:  [[#TTD+4]]: cond
 // CHECK-NEXT:  [[#TTD+5]]: [B1.[[#TTD+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TTD+6]]: [B1.[[#TTD+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TTD+7]]: #pragma omp target teams distribute if(cond)
+// CHECK-NEXT:  [[#TTD+7]]: fp
+// CHECK-NEXT:  [[#TTD+8]]: argc
+// CHECK-NEXT:  [[#TTD+9]]: x
+// CHECK-NEXT:  [[#TTD+10]]: #pragma omp target teams distribute if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TTD+3]]];
-#pragma omp target teams distribute if(cond)
+#pragma omp target teams distribute if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TTDPF:]]: x
-// CHECK-NEXT:  [[#TTDPF+1]]: [B1.[[#TTDPF]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TTDPF+2]]: argc
-// CHECK-NEXT:  [[#TTDPF+3]]: [B1.[[#TTDPF+2]]] = [B1.[[#TTDPF+1]]]
+// CHECK-NEXT:  [[#TTDPF:]]:
+// CHECK-SAME:  [B1.[[#TTDPF+9]]]
+// CHECK-NEXT:  [[#TTDPF+1]]: [B1.[[#TTDPF+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TTDPF+2]]: [B1.[[#TTDPF+8]]]
+// CHECK-NEXT:  [[#TTDPF+3]]: [B1.[[#TTDPF+8]]] = [B1.[[#TTDPF+1]]]
 // CHECK-NEXT:  [[#TTDPF+4]]: cond
 // CHECK-NEXT:  [[#TTDPF+5]]: [B1.[[#TTDPF+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TTDPF+6]]: [B1.[[#TTDPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TTDPF+7]]: #pragma omp target teams distribute parallel for if(cond)
+// CHECK-NEXT:  [[#TTDPF+7]]: fp
+// CHECK-NEXT:  [[#TTDPF+8]]: argc
+// CHECK-NEXT:  [[#TTDPF+9]]: x
+// CHECK-NEXT:  [[#TTDPF+10]]: #pragma omp target teams distribute parallel for if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TTDPF+3]]];
-#pragma omp target teams distribute parallel for if(cond)
+#pragma omp target teams distribute parallel for if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TTDPFS:]]: x
-// CHECK-NEXT:  [[#TTDPFS+1]]: [B1.[[#TTDPFS]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TTDPFS+2]]: argc
-// CHECK-NEXT:  [[#TTDPFS+3]]: [B1.[[#TTDPFS+2]]] = [B1.[[#TTDPFS+1]]]
+// CHECK-NEXT:  [[#TTDPFS:]]:
+// CHECK-SAME:  [B1.[[#TTDPFS+9]]]
+// CHECK-NEXT:  [[#TTDPFS+1]]: [B1.[[#TTDPFS+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TTDPFS+2]]: [B1.[[#TTDPFS+8]]]
+// CHECK-NEXT:  [[#TTDPFS+3]]: [B1.[[#TTDPFS+8]]] = [B1.[[#TTDPFS+1]]]
 // CHECK-NEXT:  [[#TTDPFS+4]]: cond
 // CHECK-NEXT:  [[#TTDPFS+5]]: [B1.[[#TTDPFS+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TTDPFS+6]]: [B1.[[#TTDPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TTDPFS+7]]: #pragma omp target teams distribute parallel for simd if(parallel: cond)
+// CHECK-NEXT:  [[#TTDPFS+7]]: fp
+// CHECK-NEXT:  [[#TTDPFS+8]]: argc
+// CHECK-NEXT:  [[#TTDPFS+9]]: x
+// CHECK-NEXT:  [[#TTDPFS+10]]: #pragma omp target teams distribute parallel for simd if(parallel: cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TTDPFS+3]]];
-#pragma omp target teams distribute parallel for simd if(parallel:cond)
+#pragma omp target teams distribute parallel for simd if(parallel:cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TTDS:]]: x
-// CHECK-NEXT:  [[#TTDS+1]]: [B1.[[#TTDS]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TTDS+2]]: argc
-// CHECK-NEXT:  [[#TTDS+3]]: [B1.[[#TTDS+2]]] = [B1.[[#TTDS+1]]]
+// CHECK-NEXT:  [[#TTDS:]]:
+// CHECK-SAME:  [B1.[[#TTDS+9]]]
+// CHECK-NEXT:  [[#TTDS+1]]: [B1.[[#TTDS+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TTDS+2]]: [B1.[[#TTDS+8]]]
+// CHECK-NEXT:  [[#TTDS+3]]: [B1.[[#TTDS+8]]] = [B1.[[#TTDS+1]]]
 // CHECK-NEXT:  [[#TTDS+4]]: cond
 // CHECK-NEXT:  [[#TTDS+5]]: [B1.[[#TTDS+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TTDS+6]]: [B1.[[#TTDS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TTDS+7]]: #pragma omp target teams distribute simd if(cond)
+// CHECK-NEXT:  [[#TTDS+7]]: fp
+// CHECK-NEXT:  [[#TTDS+8]]: argc
+// CHECK-NEXT:  [[#TTDS+9]]: x
+// CHECK-NEXT:  [[#TTDS+10]]: #pragma omp target teams distribute simd if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TTDS+3]]];
-#pragma omp target teams distribute simd if(cond)
+#pragma omp target teams distribute simd if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TT:]]: x
-// CHECK-NEXT:  [[#TT+1]]: [B1.[[#TT]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TT+2]]: argc
-// CHECK-NEXT:  [[#TT+3]]: [B1.[[#TT+2]]] = [B1.[[#TT+1]]]
+// CHECK-NEXT:  [[#TT:]]:
+// CHECK-SAME:  [B1.[[#TT+9]]]
+// CHECK-NEXT:  [[#TT+1]]: [B1.[[#TT+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TT+2]]: [B1.[[#TT+8]]]
+// CHECK-NEXT:  [[#TT+3]]: [B1.[[#TT+8]]] = [B1.[[#TT+1]]]
 // CHECK-NEXT:  [[#TT+4]]: cond
 // CHECK-NEXT:  [[#TT+5]]: [B1.[[#TT+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TT+6]]: [B1.[[#TT+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TT+7]]: #pragma omp target teams if(cond)
+// CHECK-NEXT:  [[#TT+7]]: fp
+// CHECK-NEXT:  [[#TT+8]]: argc
+// CHECK-NEXT:  [[#TT+9]]: x
+// CHECK-NEXT:  [[#TT+10]]: #pragma omp target teams if(cond) firstprivate(fp)
 // CHECK-NEXT:    [B1.[[#TT+3]]];
-#pragma omp target teams if(cond)
+#pragma omp target teams if(cond) firstprivate(fp)
   argc = x;
 // CHECK-NEXT: [[#TU:]]: cond
 // CHECK-NEXT: [[#TU+1]]: [B1.[[#TU]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT: [[#TU+2]]: [B1.[[#TU+1]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
 // CHECK-NEXT: [[#TU+3]]: #pragma omp target update to(x) if(target update: cond)
 #pragma omp target update to(x) if(target update:cond)
-// CHECK-NEXT:  [[#TASK:]]: x
-// CHECK-NEXT:  [[#TASK+1]]: [B1.[[#TASK]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TASK+2]]: argc
-// CHECK-NEXT:  [[#TASK+3]]: [B1.[[#TASK+2]]] = [B1.[[#TASK+1]]]
+// CHECK-NEXT:  [[#TASK:]]:
+// CHECK-SAME:  [B1.[[#TASK+9]]]
+// CHECK-NEXT:  [[#TASK+1]]: [B1.[[#TASK+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TASK+2]]: [B1.[[#TASK+8]]]
+// CHECK-NEXT:  [[#TASK+3]]: [B1.[[#TASK+8]]] = [B1.[[#TASK+1]]]
 // CHECK-NEXT:  [[#TASK+4]]: cond
 // CHECK-NEXT:  [[#TASK+5]]: [B1.[[#TASK+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TASK+6]]: [B1.[[#TASK+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TASK+7]]: #pragma omp task if(cond)
+// CHECK-NEXT:  [[#TASK+7]]: fp
+// CHECK-NEXT:  [[#TASK+8]]: argc
+// CHECK-NEXT:  [[#TASK+9]]: x
+// CHECK-NEXT:  [[#TASK+10]]: #pragma omp task if(cond) firstprivate(fp)
 // CHECK-NEXT:    [B1.[[#TASK+3]]];
-#pragma omp task if(cond)
+#pragma omp task if(cond) firstprivate(fp)
   argc = x;
 // CHECK-NEXT:  [[#TG:]]: x
 // CHECK-NEXT:  [[#TG+1]]: [B1.[[#TG]]] (ImplicitCastExpr, LValueToRValue, int)
@@ -319,30 +370,38 @@ void xxx(int argc) {
 // CHECK-NEXT:    [B1.[[#TG+3]]];
 #pragma omp taskgroup
   argc = x;
-// CHECK-NEXT:  [[#TL:]]: x
-// CHECK-NEXT:  [[#TL+1]]: [B1.[[#TL]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TL+2]]: argc
-// CHECK-NEXT:  [[#TL+3]]: [B1.[[#TL+2]]] = [B1.[[#TL+1]]]
+// CHECK-NEXT:  [[#TL:]]:
+// CHECK-SAME:  [B1.[[#TL+9]]]
+// CHECK-NEXT:  [[#TL+1]]: [B1.[[#TL+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TL+2]]: [B1.[[#TL+8]]]
+// CHECK-NEXT:  [[#TL+3]]: [B1.[[#TL+8]]] = [B1.[[#TL+1]]]
 // CHECK-NEXT:  [[#TL+4]]: cond
 // CHECK-NEXT:  [[#TL+5]]: [B1.[[#TL+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TL+6]]: [B1.[[#TL+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TL+7]]: #pragma omp taskloop if(cond)
+// CHECK-NEXT:  [[#TL+7]]: fp
+// CHECK-NEXT:  [[#TL+8]]: argc
+// CHECK-NEXT:  [[#TL+9]]: x
+// CHECK-NEXT:  [[#TL+10]]: #pragma omp taskloop if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TL+3]]];
-#pragma omp taskloop if(cond)
+#pragma omp taskloop if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [[#TLS:]]: x
-// CHECK-NEXT:  [[#TLS+1]]: [B1.[[#TLS]]] (ImplicitCastExpr, LValueToRValue, int)
-// CHECK-NEXT:  [[#TLS+2]]: argc
-// CHECK-NEXT:  [[#TLS+3]]: [B1.[[#TLS+2]]] = [B1.[[#TLS+1]]]
+// CHECK-NEXT:  [[#TLS:]]:
+// CHECK-SAME:  [B1.[[#TLS+9]]]
+// CHECK-NEXT:  [[#TLS+1]]: [B1.[[#TLS+9]]] (ImplicitCastExpr, LValueToRValue, int)
+// CHECK-NEXT:  [[#TLS+2]]: [B1.[[#TLS+8]]]
+// CHECK-NEXT:  [[#TLS+3]]: [B1.[[#TLS+8]]] = [B1.[[#TLS+1]]]
 // CHECK-NEXT:  [[#TLS+4]]: cond
 // CHECK-NEXT:  [[#TLS+5]]: [B1.[[#TLS+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TLS+6]]: [B1.[[#TLS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TLS+7]]: #pragma omp taskloop simd if(cond)
+// CHECK-NEXT:  [[#TLS+7]]: fp
+// CHECK-NEXT:  [[#TLS+8]]: argc
+// CHECK-NEXT:  [[#TLS+9]]: x
+// CHECK-NEXT:  [[#TLS+10]]: #pragma omp taskloop simd if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TLS+3]]];
-#pragma omp taskloop simd if(cond)
+#pragma omp taskloop simd if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
 // CHECK-NEXT:  [[#TDPF:]]: x
@@ -352,51 +411,69 @@ void xxx(int argc) {
 // CHECK-NEXT:  [[#TDPF+4]]: cond
 // CHECK-NEXT:  [[#TDPF+5]]: [B1.[[#TDPF+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TDPF+6]]: [B1.[[#TDPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TDPF+7]]: #pragma omp teams distribute parallel for if(cond)
+// CHECK-NEXT:  [[#TDPF+7]]: [B1.[[#TDPF+9]]]
+// CHECK-NEXT:  [[#TDPF+8]]: #pragma omp teams distribute parallel for if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TDPF+3]]];
-// CHECK-NEXT:  [[#TDPF+8]]: #pragma omp target
+// CHECK-NEXT:  [[#TDPF+9]]: fp
+// CHECK-NEXT:  [[#TDPF+10]]: argc
+// CHECK-NEXT:  [[#TDPF+11]]: x
+// CHECK-NEXT:  [[#TDPF+12]]: cond
+// CHECK-NEXT:  [[#TDPF+13]]: #pragma omp target
 #pragma omp target
-#pragma omp teams distribute parallel for if(cond)
+#pragma omp teams distribute parallel for if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [B1.[[#TDPF+7]]] [[#TDPFS:]]: x
+// CHECK-NEXT:  [B1.[[#TDPF+8]]] [[#TDPFS:]]: x
 // CHECK-NEXT:  [[#TDPFS+1]]: [B1.[[#TDPFS]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TDPFS+2]]: argc
 // CHECK-NEXT:  [[#TDPFS+3]]: [B1.[[#TDPFS+2]]] = [B1.[[#TDPFS+1]]]
 // CHECK-NEXT:  [[#TDPFS+4]]: cond
 // CHECK-NEXT:  [[#TDPFS+5]]: [B1.[[#TDPFS+4]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TDPFS+6]]: [B1.[[#TDPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
-// CHECK-NEXT:  [[#TDPFS+7]]: #pragma omp teams distribute parallel for simd if(cond)
+// CHECK-NEXT:  [[#TDPFS+7]]: [B1.[[#TDPFS+9]]]
+// CHECK-NEXT:  [[#TDPFS+8]]: #pragma omp teams distribute parallel for simd if(cond) firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TDPFS+3]]];
-// CHECK-NEXT:  [[#TDPFS+8]]: #pragma omp target
+// CHECK-NEXT:  [[#TDPFS+9]]: fp
+// CHECK-NEXT:  [[#TDPFS+10]]: argc
+// CHECK-NEXT:  [[#TDPFS+11]]: x
+// CHECK-NEXT:  [[#TDPFS+12]]: cond
+// CHECK-NEXT:  [[#TDPFS+13]]: #pragma omp target
 #pragma omp target
-#pragma omp teams distribute parallel for simd if(cond)
+#pragma omp teams distribute parallel for simd if(cond) firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [B1.[[#TDPFS+7]]] [[#TDS:]]: x
+// CHECK-NEXT:  [B1.[[#TDPFS+8]]] [[#TDS:]]: x
 // CHECK-NEXT:  [[#TDS+1]]: [B1.[[#TDS]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TDS+2]]: argc
 // CHECK-NEXT:  [[#TDS+3]]: [B1.[[#TDS+2]]] = [B1.[[#TDS+1]]]
-// CHECK-NEXT:  [[#TDS+4]]: #pragma omp teams distribute simd
+// CHECK-NEXT:  [[#TDS+4]]: [B1.[[#TDS+6]]]
+// CHECK-NEXT:  [[#TDS+5]]: #pragma omp teams distribute simd firstprivate(fp)
 // CHECK-NEXT:    for (int i = 0; i < 10; ++i)
 // CHECK-NEXT:        [B1.[[#TDS+3]]];
-// CHECK-NEXT:  [[#TDS+5]]: #pragma omp target
+// CHECK-NEXT:  [[#TDS+6]]: fp
+// CHECK-NEXT:  [[#TDS+7]]: argc
+// CHECK-NEXT:  [[#TDS+8]]: x
+// CHECK-NEXT:  [[#TDS+9]]: #pragma omp target
 #pragma omp target
-#pragma omp teams distribute simd
+#pragma omp teams distribute simd firstprivate(fp)
   for (int i = 0; i < 10; ++i)
     argc = x;
-// CHECK-NEXT:  [B1.[[#TDS+4]]] [[#TEAMS:]]: x
+// CHECK-NEXT:  [B1.[[#TDS+5]]] [[#TEAMS:]]: x
 // CHECK-NEXT:  [[#TEAMS+1]]: [B1.[[#TEAMS]]] (ImplicitCastExpr, LValueToRValue, int)
 // CHECK-NEXT:  [[#TEAMS+2]]: argc
 // CHECK-NEXT:  [[#TEAMS+3]]: [B1.[[#TEAMS+2]]] = [B1.[[#TEAMS+1]]]
-// CHECK-NEXT:  [[#TEAMS+4]]: #pragma omp teams
+// CHECK-NEXT:  [[#TEAMS+4]]: [B1.[[#TEAMS+6]]]
+// CHECK-NEXT:  [[#TEAMS+5]]: #pragma omp teams firstprivate(fp)
 // CHECK-NEXT:    [B1.[[#TEAMS+3]]];
-// CHECK-NEXT:  [[#TEAMS+5]]: #pragma omp target
+// CHECK-NEXT:  [[#TEAMS+6]]: fp
+// CHECK-NEXT:  [[#TEAMS+7]]: argc
+// CHECK-NEXT:  [[#TEAMS+8]]: x
+// CHECK-NEXT:  [[#TEAMS+9]]: #pragma omp target
 #pragma omp target
-#pragma omp teams
+#pragma omp teams firstprivate(fp)
   argc = x;
-// CHECK-NEXT:  [B1.[[#TEAMS+4]]]   Preds
+// CHECK-NEXT:  [B1.[[#TEAMS+5]]]   Preds
 }
 
index d283c29c3284a71d1dac8c22834b1dd09046de91..3206c1c71a01de46faa455bb0ee4980a79e4414a 100644 (file)
@@ -8,6 +8,14 @@ void foo() {
 bool foobool(int argc) {
   return argc;
 }
+
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp distribute parallel for firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 extern int omp_default_mem_alloc;
 
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
index 953cd20971518025eef3834d489c8bbca2daf2c9..a28b4335b241b3e36e09a752e3fdd9e551260477 100644 (file)
@@ -10,6 +10,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp distribute parallel for simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index b0f0c6a8c85506950ea652a01d7548cdd85b441a..87a05867ce05784452e9b9bd8ddfec76c55363f4 100644 (file)
@@ -10,6 +10,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp parallel firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 8a312f47662ef6b1a4a5f43b9ed9516ddbd6568d..38d7c5755d1c581abafbf1fba54ee8c3588a6580 100644 (file)
@@ -10,6 +10,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp parallel for firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 5f57c65374a36e43e358cbc233abecdd13a41af7..308bd84cb1e2f366477043bab64fe02e075cd66c 100644 (file)
@@ -10,6 +10,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp parallel for simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index f07a7206958a6861dd1fcf4926ffca964884c009..d0d22797c5c9443b977dee4226ccac6c6934b473 100644 (file)
@@ -10,6 +10,15 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp parallel sections firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  {
+    for (int i = 0; i < 10; ++i)
+      ;
+  }
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index d96516aebe713a573f166ac560229c10761f7878..2b4bf832328393bcc5f994392951c6e6b04349c2 100644 (file)
@@ -2,6 +2,13 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
 
+void xxx(int argc) {
+  int fp, fp1; // expected-note {{initialize the variable 'fp' to silence this warning}} expected-note {{initialize the variable 'fp1' to silence this warning}}
+#pragma omp target firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ++fp1; // expected-warning {{variable 'fp1' is uninitialized when used here}}
+}
+
 typedef void **omp_allocator_handle_t;
 extern const omp_allocator_handle_t omp_default_mem_alloc;
 extern const omp_allocator_handle_t omp_large_cap_mem_alloc;
index 075beaeac82f34f8a102e2ad05dc19cb7cad1f3e..11be23cab8dcff59d760016416a5e465f65bd2cf 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target parallel firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index d90c02478c5eec01db866a472be8ccf94878abc1..0a103edc5822ae541c441def6ea914d4125dc7ef 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target parallel for firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index b2ffe3b3840d465602b0621b1b0b3b0dbbb7cc8a..4a25753ba5287d5f2974c82ede457f2ac95babc2 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target parallel for simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 651afdde8ab45062b197856acf74577aa6b11733..e5696c9163d1718a814ce4b3d47d852c75eb773c 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 8d53c3cbc0b3957cdc722bf2d935ace2be7d3ca4..fe5387e5ab12286145dea90eeccb38f36496056c 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target teams distribute firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index a03c781892bca8a36a5af08a33b5aa89da465d13..b0a7da9c932d11ddf6a87c26d8d944650a6854af 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target teams distribute parallel for firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index d018421fa8a4304ee5bd36c865d242818f4e792f..17aa7f488534ad99e46bd4330fb5cb779cbb7ef9 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target teams distribute parallel for simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 82274fe00e27eb20ac5bd289b0b9835584677204..3050222379bd0234646520e928dcba34edc178ce 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target teams distribute simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 7958d6f494ae7d3ae6d81c8a2a3313989a74ff03..1f4f40d675337c0e6dc61eec1822252d74d78d22 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target teams firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index b8ff2cdebc91241ed9fbb0be3c7c644ea65f26c8..fa0436ace646e84c5809899fb4b5f52ae3931d1e 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp, fp1; // expected-note {{initialize the variable 'fp' to silence this warning}} expected-note {{initialize the variable 'fp1' to silence this warning}}
+#pragma omp task firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ++fp1; // expected-warning {{variable 'fp1' is uninitialized when used here}}
+}
+
 template <typename T>
 struct S {
   T b;
index b5311f5e27f941c8d38dfdee29f16a71c19860ca..8617a1f4b4b80692b7bfc25f997658b3392362a6 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp taskloop firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index fdedda93a735dd9535b21a29310a8773f453d848..2531a189c90b5bbdb9239af792f66df17316e6f2 100644 (file)
@@ -19,6 +19,13 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp taskloop simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 63237e12c96501e35c09908e98daa9f235192f1f..4a16ed93d689893a645d220b3b6a95920bdcb202 100644 (file)
@@ -10,6 +10,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target
+#pragma omp teams distribute firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index b6fac35b765f5f11011237fdf4237c57ffa1f711..9e4f7c589b53aa50269d58ee373f0d41d62aba32 100644 (file)
@@ -10,6 +10,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target
+#pragma omp teams distribute parallel for firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index 87098ca45a6061844f58edbd310274e92413b8ce..a95ea9fb169214ff0d5b645ff6fc20dc061f5d0b 100644 (file)
@@ -10,6 +10,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target
+#pragma omp teams distribute parallel for simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index f9818964aeba972b2fd2f26daffe93a4975147df..f10afbdd7a042ca4f045b9cfc96147c728c4e6c1 100644 (file)
@@ -10,6 +10,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target
+#pragma omp teams distribute simd firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
index ff58f42994d6ebbfdd44b605ae91a482d1b8da6b..6dc7d128e0ca486d0c6c0c687a00ceda627097b0 100644 (file)
@@ -10,6 +10,14 @@ bool foobool(int argc) {
   return argc;
 }
 
+void xxx(int argc) {
+  int fp; // expected-note {{initialize the variable 'fp' to silence this warning}}
+#pragma omp target
+#pragma omp teams firstprivate(fp) // expected-warning {{variable 'fp' is uninitialized when used here}}
+  for (int i = 0; i < 10; ++i)
+    ;
+}
+
 struct S1; // expected-note {{declared here}} expected-note{{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {