]> granicus.if.org Git - clang/commitdiff
[OPENMP]Add check for undefined behavior with thread allocators on
authorAlexey Bataev <a.bataev@hotmail.com>
Thu, 28 Mar 2019 19:15:36 +0000 (19:15 +0000)
committerAlexey Bataev <a.bataev@hotmail.com>
Thu, 28 Mar 2019 19:15:36 +0000 (19:15 +0000)
target and task-based directives.

According to OpenMP 5.0, 2.11.4 allocate Clause, Restrictions, For task,
taskloop or target directives, allocation requests to memory allocators
with the trait access set to thread result in unspecified behavior.
Patch introduces a check for omp_thread_mem_alloc predefined allocator
on target- and trask-based directives.

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

58 files changed:
include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaOpenMP.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_lastprivate_messages.cpp
test/OpenMP/target_parallel_for_linear_messages.cpp
test/OpenMP/target_parallel_for_private_messages.cpp
test/OpenMP/target_parallel_for_reduction_messages.cpp
test/OpenMP/target_parallel_for_simd_firstprivate_messages.cpp
test/OpenMP/target_parallel_for_simd_lastprivate_messages.cpp
test/OpenMP/target_parallel_for_simd_linear_messages.cpp
test/OpenMP/target_parallel_for_simd_private_messages.cpp
test/OpenMP/target_parallel_for_simd_reduction_messages.cpp
test/OpenMP/target_parallel_private_messages.cpp
test/OpenMP/target_parallel_reduction_messages.cpp
test/OpenMP/target_private_messages.cpp
test/OpenMP/target_reduction_messages.cpp
test/OpenMP/target_simd_firstprivate_messages.cpp
test/OpenMP/target_simd_lastprivate_messages.cpp
test/OpenMP/target_simd_linear_messages.cpp
test/OpenMP/target_simd_private_messages.cpp
test/OpenMP/target_simd_reduction_messages.cpp
test/OpenMP/target_teams_distribute_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_private_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_linear_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_private_messages.cpp
test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp
test/OpenMP/target_teams_distribute_private_messages.cpp
test/OpenMP/target_teams_distribute_reduction_messages.cpp
test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp
test/OpenMP/target_teams_distribute_simd_lastprivate_messages.cpp
test/OpenMP/target_teams_distribute_simd_linear_messages.cpp
test/OpenMP/target_teams_distribute_simd_private_messages.cpp
test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp
test/OpenMP/target_teams_firstprivate_messages.cpp
test/OpenMP/target_teams_private_messages.cpp
test/OpenMP/target_teams_reduction_messages.cpp
test/OpenMP/task_firstprivate_messages.cpp
test/OpenMP/task_in_reduction_message.cpp
test/OpenMP/task_private_messages.cpp
test/OpenMP/taskloop_firstprivate_messages.cpp
test/OpenMP/taskloop_in_reduction_messages.cpp
test/OpenMP/taskloop_lastprivate_messages.cpp
test/OpenMP/taskloop_private_messages.cpp
test/OpenMP/taskloop_reduction_messages.cpp
test/OpenMP/taskloop_simd_firstprivate_messages.cpp
test/OpenMP/taskloop_simd_in_reduction_messages.cpp
test/OpenMP/taskloop_simd_lastprivate_messages.cpp
test/OpenMP/taskloop_simd_linear_messages.cpp
test/OpenMP/taskloop_simd_private_messages.cpp
test/OpenMP/taskloop_simd_reduction_messages.cpp

index c19a88b7452c0a1c8fce03fc134a44dfb78f8b6f..851cd0d8e14983d6927e63bd2fc155537a1ed18a 100644 (file)
@@ -9158,6 +9158,9 @@ def note_omp_previous_allocator : Note<
 def err_expected_allocator_clause : Error<"expected an 'allocator' clause "
   "inside of the target region; provide an 'allocator' clause or use 'requires'"
   " directive with the 'dynamic_allocators' clause">;
+def warn_omp_allocate_thread_on_task_target_directive : Warning<
+  "allocator with the 'thread' trait access has unspecified behavior on '%0' directive">,
+  InGroup<OpenMPClauses>;
 } // end of OpenMP category
 
 let CategoryName = "Related Result Type Issue" in {
index b4c8a644a3973e67f099531b214121c7788ebe11..0971277de7585822e7e3a2d4e242e0e51b91cd4f 100644 (file)
@@ -3640,6 +3640,33 @@ static bool checkIfClauses(Sema &S, OpenMPDirectiveKind Kind,
   return ErrorFound;
 }
 
+static bool checkAllocateClauses(Sema &S, DSAStackTy *Stack,
+                                 ArrayRef<OMPClause *> Clauses) {
+  assert(!S.CurContext->isDependentContext() &&
+         "Expected non-dependent context.");
+  bool IsCorrect = true;
+  auto AllocateRange =
+      llvm::make_filter_range(Clauses, OMPAllocateClause::classof);
+  for (OMPClause *C : AllocateRange) {
+    auto *AC = cast<OMPAllocateClause>(C);
+    OMPAllocateDeclAttr::AllocatorTypeTy AllocatorKind =
+        getAllocatorKind(S, Stack, AC->getAllocator());
+    // OpenMP, 2.11.4 allocate Clause, Restrictions.
+    // For task, taskloop or target directives, allocation requests to memory
+    // allocators with the trait access set to thread result in unspecified
+    // behavior.
+    if (AllocatorKind == OMPAllocateDeclAttr::OMPThreadMemAlloc &&
+        (isOpenMPTaskingDirective(Stack->getCurrentDirective()) ||
+         isOpenMPTargetExecutionDirective(Stack->getCurrentDirective()))) {
+      S.Diag(AC->getAllocator()->getExprLoc(),
+             diag::warn_omp_allocate_thread_on_task_target_directive)
+          << getOpenMPDirectiveName(Stack->getCurrentDirective());
+      continue;
+    }
+  }
+  return !IsCorrect;
+}
+
 StmtResult Sema::ActOnOpenMPExecutableDirective(
     OpenMPDirectiveKind Kind, const DeclarationNameInfo &DirName,
     OpenMPDirectiveKind CancelRegion, ArrayRef<OMPClause *> Clauses,
@@ -3973,6 +4000,12 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
     ErrorFound = checkIfClauses(*this, Kind, Clauses, AllowedNameModifiers) ||
                  ErrorFound;
 
+  // Check allocate clauses.
+  if (!CurContext->isDependentContext()) {
+    ErrorFound = checkAllocateClauses(*this, DSAStack, ClausesWithImplicit) ||
+                 ErrorFound;
+  }
+
   if (ErrorFound)
     return StmtError();
 
index 2ab3a80a5ed27561e9bf035ac742872657cff6a9..248751f789852e5285db1a73db9e2bcc79590e92 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
@@ -112,7 +121,7 @@ int foomain(I argc, C **argv) {
 {}
 #pragma omp target firstprivate(argv[1]) // expected-error {{expected variable name}}
 {}
-#pragma omp target firstprivate(e, g)
+#pragma omp target firstprivate(e, g) allocate(omp_thread_mem_alloc: e) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target' directive}}
 {}
 #pragma omp target firstprivate(h) // expected-error {{threadprivate or thread local variable cannot be firstprivate}}
 {}
index 36490394a09f14845cb8dfe4824bf3ed50ea01bd..d6c1bb24961190392590b346e0fd5283341274e1 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -86,7 +95,7 @@ int main(int argc, char **argv) {
   foo();
   #pragma omp target parallel firstprivate (argv[1]) // expected-error {{expected variable name}}
   foo();
-  #pragma omp target parallel firstprivate(ba)
+  #pragma omp target parallel firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel' directive}}
   foo();
   #pragma omp target parallel firstprivate(ca)
   foo();
index 3a425178d1461a363f390e6a539e301ed096f30f..286faec963099a7906889cdc468a3950570cf289 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -172,7 +181,7 @@ int main(int argc, char **argv) {
 #pragma omp target parallel for firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
   for (i = 0; i < argc; ++i)
     foo();
-#pragma omp target parallel for firstprivate(argc)
+#pragma omp target parallel for allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp target parallel for firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
index ce5e1bfbd0cbf83e15b97f0ce6f2fc8270a6381d..d01e393baedef7997705817b82469678fb4446d4 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -178,7 +187,7 @@ int main(int argc, char **argv) {
 #pragma omp target parallel for lastprivate(2 * 2) // expected-error {{expected variable name}}
   for (i = 0; i < argc; ++i)
     foo();
-#pragma omp target parallel for lastprivate(ba)
+#pragma omp target parallel for lastprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}}
   for (i = 0; i < argc; ++i)
     foo();
 #pragma omp target parallel for lastprivate(ca) // expected-error {{const-qualified variable without mutable fields cannot be lastprivate}}
index c08530398c00f7acd905932f1e596732d02e9216..3556faa3cab647abd4b1be8ea0233b25e0ab2ec0 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 namespace X {
 int x;
 };
@@ -154,7 +163,7 @@ int foomain(I argc, C **argv) {
 #pragma omp target parallel for linear(argv[1]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k)
     ++k;
-#pragma omp target parallel for linear(e, g)
+#pragma omp target parallel for allocate(omp_thread_mem_alloc: e) linear(e, g) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}}
   for (int k = 0; k < argc; ++k)
     ++k;
 #pragma omp target parallel for linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}}
index 4a6b2c28990b74cb5f5fe2096106be87aacd63e7..2e3848a60002510511abaac0223d26aa649f86d0 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -129,7 +138,7 @@ int foomain(I argc, C **argv) {
 #pragma omp target parallel for private(argv[1]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k)
     ++k;
-#pragma omp target parallel for private(e, g)
+#pragma omp target parallel for private(e, g) allocate(omp_thread_mem_alloc: e) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}}
   for (int k = 0; k < argc; ++k)
     ++k;
 #pragma omp target parallel for private(h) // expected-error {{threadprivate or thread local variable cannot be private}}
index 8eeafd4548870d72815b57c9c27a109b97ff7fd0..3b201f2f2ee6fde07b73967929169e97a457828e 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -316,7 +325,7 @@ int main(int argc, char **argv) {
   for (int i = 0; i < 10; ++i)
     foo();
   static int m;
-#pragma omp target parallel for reduction(+ : m) // OK
+#pragma omp target parallel for allocate(omp_thread_mem_alloc: m) reduction(+ : m) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for' directive}}
   for (int i = 0; i < 10; ++i)
     m++;
 
index aebc45a93770605e352df83d30204ca58312e28d..77661a3133604948e42da544dba3a26384263764 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -87,7 +96,7 @@ int foomain(int argc, char **argv) {
 #pragma omp target parallel for simd firstprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k)
     ++k;
-#pragma omp target parallel for simd firstprivate(argc)
+#pragma omp target parallel for simd firstprivate(argc) allocate(omp_thread_mem_alloc: argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}}
   for (int k = 0; k < argc; ++k)
     ++k;
 #pragma omp target parallel for simd firstprivate(S1) // expected-error {{'S1' does not refer to a value}}
index 82271e1be0349875149467cdb372dbc0f1d8117f..750fa3b19a77fc2f209a4393ea0caaea4f7d384f 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -89,7 +98,7 @@ int foomain(int argc, char **argv) {
 #pragma omp target parallel for simd lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k)
     ++k;
-#pragma omp target parallel for simd lastprivate(argc)
+#pragma omp target parallel for simd allocate(omp_thread_mem_alloc: argc) lastprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}}
   for (int k = 0; k < argc; ++k)
     ++k;
 #pragma omp target parallel for simd lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
index 30b0308a22d4867917bac5495f7288d410e87bde..b5664dd3179c02decc746b88295ad56780228365 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 namespace X {
 int x;
 };
@@ -43,7 +52,7 @@ void test_linear_colons() {
 #pragma omp target parallel for simd linear(B, ::z, X::x)
   for (int i = 0; i < 10; ++i)
     ;
-#pragma omp target parallel for simd linear(::z)
+#pragma omp target parallel for simd linear(::z) allocate(omp_thread_mem_alloc: ::z) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}}
   for (int i = 0; i < 10; ++i)
     ;
 // expected-error@+1 {{expected variable name}}
index 923f6378b091efe71982584f3dc42fb782260a20..6210323330d6b5c58b5771b234a4c88059ebea62 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -59,7 +68,7 @@ public:
 
   S6() : a(0) {}
   S6(T v) : a(v) {
-#pragma omp target parallel for simd private(a) private(this->a)
+#pragma omp target parallel for simd allocate(omp_thread_mem_alloc: a) private(a) private(this->a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}}
     for (int k = 0; k < v; ++k)
       ++this->a;
   }
@@ -167,7 +176,7 @@ using A::x;
 int main(int argc, char **argv) {
   S4 e(4);
   S5 g(5);
-  S6<float> s6(0.0) , s6_0(1.0);
+  S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}}
   S7<S6<float> > s7(0.0) , s7_0(1.0);
   int i;
   int &j = i;
index 5d40388fa9842d867f35cbc2992e47f901af8055..87be4f1c65e3d939c123dab03fb00205ed451e92 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -15,7 +24,7 @@ bool foobool(int argc) {
 }
 
 void foobar(int &ref) {
-#pragma omp target parallel for simd reduction(+:ref)
+#pragma omp target parallel for simd reduction(+:ref) allocate(omp_thread_mem_alloc: ref) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel for simd' directive}}
   for (int i = 0; i < 10; ++i)
     foo();
 }
index 52826a54df15f72f82ca2ab5e24298d3f05eef3f..97ed1fc96add14c029427bbbe137aaec3081022e 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -87,7 +96,7 @@ int foomain(I argc, C **argv) {
 {}
 #pragma omp target parallel private(argv[1]) // expected-error {{expected variable name}}
 {}
-#pragma omp target parallel private(ba)
+#pragma omp target parallel allocate(omp_thread_mem_alloc: ba) private(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel' directive}}
 {}
 #pragma omp target parallel private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}}
 {}
index 01a9d01b7e0ad27570f28925963a0f137508b056..eca57a8cce7f4c62e2d4e143716ec1721dc2e188 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -157,7 +166,7 @@ T tmain(T argc) {
 #pragma omp for private(fl)
   for (int i = 0; i < 10; ++i)
   {}
-#pragma omp target parallel reduction(+ : fl)
+#pragma omp target parallel reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target parallel' directive}}
     foo();
 #pragma omp target parallel
 #pragma omp for reduction(- : fl)
index 4463dcfb99d7f85cd6623eaec41e9c8ca8c40928..245a0ea2b038d7a3c7e4028fa704bb715a4fca9e 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 struct S1; // expected-note 2 {{declared here}} expected-note 2 {{forward declaration of 'S1'}}
 extern S1 a;
 class S2 {
@@ -52,7 +61,7 @@ public:
 
   S6() : a(0) {}
   S6(T v) : a(v) {
-#pragma omp target private(a) private(this->a)
+#pragma omp target private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target' directive}}
     for (int k = 0; k < v; ++k)
       ++this->a;
   }
@@ -148,7 +157,7 @@ using A::x;
 int main(int argc, char **argv) {
   S4 e(4);
   S5 g(5);
-  S6<float> s6(0.0) , s6_0(1.0);
+  S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}}
   S7<S6<float> > s7(0.0) , s7_0(1.0);
   int i;
   int &j = i;
index b95be1f628c512abfeb25ae4dbcfb794ee749a5f..b9b744f4555e34cff45540a275ba7007b540bb0b 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -155,7 +164,7 @@ T tmain(T argc) {
 #pragma omp parallel
 #pragma omp for private(fl)
   for (int i = 0; i < 10; ++i)
-#pragma omp target reduction(+ : fl)
+#pragma omp target reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target' directive}}
     foo();
 #pragma omp parallel
 #pragma omp for reduction(- : fl)
index 9063937d0a0a5bc16e9e5b9b2a0a418ea42ef778..eac95ade6f1d1113924723e24befea83464ad403 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -109,7 +118,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;
-#pragma omp target simd firstprivate(i)
+#pragma omp target simd allocate(omp_thread_mem_alloc: i) firstprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;
index d7ee2ca768c5fb2dcad6dd642468f28e42def8ed..8b485840cef73d2ba0261627b5ee8d9c74abbe94 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -111,7 +120,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;
-#pragma omp target simd lastprivate(i)
+#pragma omp target simd lastprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;
index 4b04497c4a2e62b8dd1f27794f33b9788cd64114..86e3cc43fbfae63ba829b407e167c9b93e6cb913 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 namespace X {
 int x;
 };
@@ -154,7 +163,7 @@ int foomain(I argc, C **argv) {
 #pragma omp target simd linear(argv[1]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k)
     ++k;
-#pragma omp target simd linear(e, g)
+#pragma omp target simd allocate(omp_thread_mem_alloc: e) linear(e, g) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}}
   for (int k = 0; k < argc; ++k)
     ++k;
 #pragma omp target simd linear(h) // expected-error {{threadprivate or thread local variable cannot be linear}}
index 65ac875129605db1cbaae180f2681e9f1f3ba016..f95d77c302a93e747a4e1c93bf7812fe16222f0a 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -59,7 +68,7 @@ public:
 
   S6() : a(0) {}
   S6(T v) : a(v) {
-#pragma omp target simd private(a) private(this->a)
+#pragma omp target simd private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}}
     for (int k = 0; k < v; ++k)
       ++this->a;
   }
@@ -167,7 +176,7 @@ using A::x;
 int main(int argc, char **argv) {
   S4 e(4);
   S5 g(5);
-  S6<float> s6(0.0) , s6_0(1.0);
+  S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}}
   S7<S6<float> > s7(0.0) , s7_0(1.0);
   int i;
   int &j = i;
index e7a8737a636eaae4091e77dc908cecaf85d3aee9..e50159462c7051dfe86b7d42eaf3c8f70ce0c748 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -15,7 +24,7 @@ bool foobool(int argc) {
 }
 
 void foobar(int &ref) {
-#pragma omp target simd reduction(+:ref)
+#pragma omp target simd allocate(omp_thread_mem_alloc: ref) reduction(+:ref) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target simd' directive}}
   for (int i = 0; i < 10; ++i)
     foo();
 }
index b32b8f3074f69239fb6cb319966fc6a2606a9bd6..833f951b78b1931261faf81202d5ea1f87480b89 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -97,7 +106,7 @@ int main(int argc, char **argv) {
 #pragma omp target teams distribute firstprivate (argv[1]) // expected-error {{expected variable name}}
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute firstprivate(ba)
+#pragma omp target teams distribute firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}}
   for (i = 0; i < argc; ++i) foo();
 
 #pragma omp target
index 77f08f1dcd5238eb05819a2842826f1ba2b85fa6..a7e33d0e78efda7a6684f751cf4ab790ed208820 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -89,7 +98,7 @@ int foomain(int argc, char **argv) {
 #pragma omp target teams distribute lastprivate(argc > 0 ? argv[1] : argv[2]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k) ++k;
 
-#pragma omp target teams distribute lastprivate(argc)
+#pragma omp target teams distribute allocate(omp_thread_mem_alloc: argc) lastprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}}
   for (int k = 0; k < argc; ++k) ++k;
 
 #pragma omp target teams distribute lastprivate(S1) // expected-error {{'S1' does not refer to a value}}
index 4cd7c4574c1cba7197500be7dc0a0e09fd758bb4..d7be6062eb047aee4d5d5e45d43f224e3485b332 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -97,7 +106,7 @@ int main(int argc, char **argv) {
 #pragma omp target teams distribute parallel for firstprivate (argv[1]) // expected-error {{expected variable name}}
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for firstprivate(ba)
+#pragma omp target teams distribute parallel for firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}}
   for (i = 0; i < argc; ++i) foo();
 
 #pragma omp target teams distribute parallel for firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
index 661eaac0f96bc8055113b0d06ad7ea60b0fe53de..d06628fef88677e63ed4d826d2aa4fb320cc7de3 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -108,7 +117,7 @@ int foomain(int argc, char **argv) {
   for (int k = 0; k < argc; ++k) ++k;
 
   int v = 0;
-#pragma omp target teams distribute parallel for lastprivate(i)
+#pragma omp target teams distribute parallel for allocate(omp_thread_mem_alloc: i) lastprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}}
   for (int k = 0; k < argc; ++k) {
     i = k;
     v += i;
index 3c7f164572dd7df95be0dfe6a2a713f1ae07bc08..86410b3fafd38aff455c045a363baa8508aef541 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -107,7 +116,7 @@ int main(int argc, char **argv) {
 #pragma omp target teams distribute parallel for firstprivate(i), private(i) // expected-error {{firstprivate variable cannot be private}} expected-note {{defined as firstprivate}}
   for (int k = 0; k < argc; ++k) ++k;
 
-#pragma omp target teams distribute parallel for private(j)
+#pragma omp target teams distribute parallel for allocate(omp_thread_mem_alloc: j) private(j) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}}
   for (int k = 0; k < argc; ++k) ++k;
 
 #pragma omp target teams distribute parallel for reduction(+:i)
index 131ef8440cafe5b848f074e2801476d991fe47d0..01175deeca9b59efcc48d71d85dc62a13342cb4b 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -147,7 +156,7 @@ T tmain(T argc) {
 #pragma omp parallel reduction(min : i)
 #pragma omp target teams distribute parallel for reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
   for (int j=0; j<100; j++) foo();
-#pragma omp target teams distribute parallel for reduction(+ : fl)
+#pragma omp target teams distribute parallel for reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for' directive}}
     for (int j=0; j<100; j++) foo();
 
   return T();
index 3ef0389de094be0b5d403874f9bc66cf4e2fe252..46a91c953b7e4974fdb418341506a10d80076e0a 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -97,7 +106,7 @@ int main(int argc, char **argv) {
 #pragma omp target teams distribute parallel for simd firstprivate (argv[1]) // expected-error {{expected variable name}}
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute parallel for simd firstprivate(ba)
+#pragma omp target teams distribute parallel for simd allocate(omp_thread_mem_alloc: ba) firstprivate(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}}
   for (i = 0; i < argc; ++i) foo();
 
 #pragma omp target teams distribute parallel for simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
index efcd5a40989bac7a0875a9c8ad1100c93cf65b51..26520795149c942bb5c13e6b299ab6e15b564acc 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -108,7 +117,7 @@ int foomain(int argc, char **argv) {
   for (int k = 0; k < argc; ++k) ++k;
 
   int v = 0;
-#pragma omp target teams distribute parallel for simd lastprivate(i)
+#pragma omp target teams distribute parallel for simd lastprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}}
   for (int k = 0; k < argc; ++k) {
     i = k;
     v += i;
index 72d315aece697c10899a435a8eade37535a418fd..029401a64c87535f6d3b45d459546fee18306d5e 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 namespace X {
   int x;
 };
index 81ed3ad8d9d5c50fb70d854c7b156237738e3200..1f3a1313269c19a62c6ec1a374223722674753e2 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -83,7 +92,7 @@ int main(int argc, char **argv) {
   #pragma omp target teams distribute parallel for simd private (argv[1]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k) ++k;
 
-  #pragma omp target teams distribute parallel for simd private(ba)
+  #pragma omp target teams distribute parallel for simd private(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}}
   for (int k = 0; k < argc; ++k) ++k;
 
   #pragma omp target teams distribute parallel for simd private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}}
index f7dd74c87301369b7ca54c93d3423afee2ab5652..6e298a7e6b00e2a4f3a733d2a5d7f093e9e983c6 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -236,7 +245,7 @@ int main(int argc, char **argv) {
 #pragma omp parallel reduction(min : i)
 #pragma omp target teams distribute parallel for simd reduction(max : j) // expected-error {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
   for (int j=0; j<100; j++) foo();
-#pragma omp target teams distribute parallel for simd reduction(+ : fl)
+#pragma omp target teams distribute parallel for simd allocate(omp_thread_mem_alloc: fl) reduction(+ : fl) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute parallel for simd' directive}}
     for (int j=0; j<100; j++) foo();
   static int m;
 #pragma omp target teams distribute parallel for simd reduction(+ : m) // OK
index 506beddfdf110fef129b2f78fbf5a96cde3564af..93989a58401557d1dddc970745536a9db61dc959 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -83,7 +92,7 @@ int main(int argc, char **argv) {
 #pragma omp target teams distribute private (argv[1]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k) ++k;
 
-#pragma omp target teams distribute private(ba)
+#pragma omp target teams distribute private(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}}
   for (int k = 0; k < argc; ++k) ++k;
 
 #pragma omp target teams distribute private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}}
index 6c245f1f28200f36984b3e023ebe1ae670704c80..bdde93bd93a0504759fdc12dd939c7684efe29b2 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -152,7 +161,7 @@ T tmain(T argc) {
 #pragma omp parallel reduction(min : i)
 #pragma omp target teams distribute reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
   for (int j=0; j<100; j++) foo();
-#pragma omp target teams distribute reduction(+ : fl)
+#pragma omp target teams distribute allocate(omp_thread_mem_alloc: fl) reduction(+ : fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute' directive}}
     for (int j=0; j<100; j++) foo();
 
   return T();
index 65c854281d7a27f3cc226c40f2cdd96534154088..1ce3adc74d6ad8a24116be7f7d1be149a1f63a44 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -97,7 +106,7 @@ int main(int argc, char **argv) {
 #pragma omp target teams distribute simd firstprivate (argv[1]) // expected-error {{expected variable name}}
   for (i = 0; i < argc; ++i) foo();
 
-#pragma omp target teams distribute simd firstprivate(ba)
+#pragma omp target teams distribute simd firstprivate(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}}
   for (i = 0; i < argc; ++i) foo();
 
 #pragma omp target teams distribute simd firstprivate(ca) // expected-error {{no matching constructor for initialization of 'S3'}}
index bc5f3f8493a0e04f0e39affbabbb9b3ed4567fff..1235f81a21282e6d4954213e51ac8786c845712e 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -108,7 +117,7 @@ int foomain(int argc, char **argv) {
   for (int k = 0; k < argc; ++k) ++k;
 
   int v = 0;
-#pragma omp target teams distribute simd lastprivate(i)
+#pragma omp target teams distribute simd allocate(omp_thread_mem_alloc: i) lastprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}}
   for (int k = 0; k < argc; ++k) {
     i = k;
     v += i;
index a79fdcaff554fe1c81ebd87af278e99966d88c68..f4131ed7aedc351ab1562c8c4fae128b31e5eec6 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 namespace X {
   int x;
 };
index 63dad4e32e985e8a4d87ae8c56c845683f4523ee..7edcaf19a38005658cf694763eb54faee4760f84 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -83,7 +92,7 @@ int main(int argc, char **argv) {
 #pragma omp target teams distribute simd private (argv[1]) // expected-error {{expected variable name}}
   for (int k = 0; k < argc; ++k) ++k;
 
-#pragma omp target teams distribute simd private(ba)
+#pragma omp target teams distribute simd private(ba) allocate(omp_thread_mem_alloc: ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}}
   for (int k = 0; k < argc; ++k) ++k;
 
 #pragma omp target teams distribute simd private(ca) // expected-error {{const-qualified variable without mutable fields cannot be private}}
index 680794c19555fcdff40b1ab8aade483a38b46bda..c033c058025968ac40f10ed5e8cffa90e2bdd843 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -147,7 +156,7 @@ T tmain(T argc) {
 #pragma omp parallel reduction(min : i)
 #pragma omp target teams distribute simd reduction(max : j) // expected-error 2 {{argument of OpenMP clause 'reduction' must reference the same object in all threads}}
   for (int j=0; j<100; j++) foo();
-#pragma omp target teams distribute simd reduction(+ : fl)
+#pragma omp target teams distribute simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams distribute simd' directive}}
     for (int j=0; j<100; j++) foo();
 
   return T();
index 4a1ab3f048427d39852cc26a4d943000c48eec1d..9f6eb8ad81e8f0374755b4d7c035a3787c0ba343 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -87,7 +96,7 @@ int main(int argc, char **argv) {
   foo();
 #pragma omp target teams firstprivate(argv[1]) // expected-error {{expected variable name}}
   foo();
-#pragma omp target teams firstprivate(ba)
+#pragma omp target teams allocate(omp_thread_mem_alloc: ba) firstprivate(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams' directive}}
   foo();
 #pragma omp target teams firstprivate(ca)
   foo();
index 9717d37509ba58a69dc4b665efbb40eda3ae796d..7714113af70602e81287e49279f9b7c6fd4697c6 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -99,7 +108,7 @@ int main(int argc, char **argv) {
   foo();
 #pragma omp target teams private(j)
   foo();
-#pragma omp target teams firstprivate(i)
+#pragma omp target teams firstprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'target teams' directive}}
   for (int k = 0; k < 10; ++k) {
 #pragma omp parallel private(i)
     foo();
index 6c71406746f841db0b7367b0a732ca52554123ab..2d8a47b7f89415e69ea5b7338626d017ac5f0db6 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -156,7 +165,7 @@ T tmain(T argc) {
 #pragma omp parallel for private(fl)
   for (int i = 0; i < 10; ++i)
   {}
-#pragma omp target teams reduction(+ : fl)
+#pragma omp target teams reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'target teams' directive}}
     foo();
 #pragma omp target teams
 #pragma omp parallel for reduction(- : fl)
index fac5f527b964924b63efadd21d501bb58d5a886b..b34cda78d1e754fa841029632aa52148eda88ebe 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -96,7 +105,7 @@ int main(int argc, char **argv) {
 #pragma omp task firstprivate(S1)            // expected-error {{'S1' does not refer to a value}}
 #pragma omp task firstprivate(a, b, c, d, f) // expected-error {{firstprivate variable with incomplete type 'S1'}}
 #pragma omp task firstprivate(argv[1])       // expected-error {{expected variable name}}
-#pragma omp task firstprivate(ba)
+#pragma omp task allocate(omp_thread_mem_alloc: ba) firstprivate(ba) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'task' directive}}
 #pragma omp task firstprivate(ca)
 #pragma omp task firstprivate(da)
 #pragma omp task firstprivate(S2::S2s)
index 4120b73abaed80bc853f29864fcf977c5b9c73d5..d064a5f6252e5fac56f31b1060eb5b204172d69c 100644 (file)
@@ -7,7 +7,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -17,7 +26,7 @@ bool foobool(int argc) {
 
 void foobar(int &ref) {
 #pragma omp taskgroup task_reduction(+:ref)
-#pragma omp task in_reduction(+:ref)
+#pragma omp task in_reduction(+:ref) allocate(omp_thread_mem_alloc: ref) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'task' directive}}
   foo();
 }
 
index 9de045505cb6b3020fc3a876d95990a68e307261..934f5aad8c5e0ab9228d2a65055924bf51c9d11c 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -93,7 +102,7 @@ int main(int argc, char **argv) {
   foo();
 #pragma omp task firstprivate(i)
   for (int k = 0; k < 10; ++k) {
-#pragma omp task private(i)
+#pragma omp task private(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'task' directive}}
     foo();
   }
   static int m;
index 81c4fff15c041bd522fcbf5fe350458739b499f3..fde767da94ef44c69c49ba057d289c39e27be704 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -94,7 +103,7 @@ int foomain(int argc, char **argv) {
   for (int k = 0; k < argc; ++k)
     ++k;
 #pragma omp parallel
-#pragma omp taskloop firstprivate(argc)
+#pragma omp taskloop allocate(omp_thread_mem_alloc: argc) firstprivate(argc) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}}
   for (int k = 0; k < argc; ++k)
     ++k;
 #pragma omp parallel
index bcfe86de296bce76be6bd6fa017ce968295589d2..00c17d0a19b35d8a64bc4b63f7c6e3d8ac849b94 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -224,7 +233,7 @@ T tmain(T argc) {
   foo();
 #pragma omp taskgroup task_reduction(+:fl)
 {
-#pragma omp taskloop in_reduction(+ : fl)
+#pragma omp taskloop in_reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp taskgroup task_reduction(*:fl) // expected-note 2 {{previously marked as task_reduction with different reduction operation}}
index 5740aa50ad8f672f577b97486904bb4aa127b4bf..929d2b801c5b08b1c4f51f02d4a50570e8482ccd 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -123,7 +132,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;
-#pragma omp taskloop lastprivate(i)
+#pragma omp taskloop allocate(omp_thread_mem_alloc: i) lastprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;
index cba929cf3fa12934f8f14e4d90ada873b2171661..107a2f4b766167d423acfba28ff974ac51c1c468 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -59,7 +68,7 @@ public:
 
   S6() : a(0) {}
   S6(T v) : a(v) {
-#pragma omp taskloop private(a) private(this->a)
+#pragma omp taskloop private(a) private(this->a) allocate(omp_thread_mem_alloc: a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}}
     for (int k = 0; k < v; ++k)
       ++this->a;
   }
@@ -177,7 +186,7 @@ using A::x;
 int main(int argc, char **argv) {
   S4 e(4);
   S5 g(5);
-  S6<float> s6(0.0) , s6_0(1.0);
+  S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}}
   S7<S6<float> > s7(0.0) , s7_0(1.0);
   int i;
   int &j = i;
index 93024384cef0872cbc65c39a35049b079534e807..a1c533cfe0903c12a476741e80e824b97abbf5e3 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -192,7 +201,7 @@ T tmain(T argc) {
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel private(fl)
-#pragma omp taskloop reduction(+ : fl)
+#pragma omp taskloop reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop' directive}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel reduction(* : fl)
index 662c4a5416773bbed6f8279fecf08423d01c6a2b..7553bd2fece4053171ee55592557811067569707 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -121,7 +130,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;
-#pragma omp taskloop simd firstprivate(i)
+#pragma omp taskloop simd allocate(omp_thread_mem_alloc: i) firstprivate(i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;
index 8d62ec8f49d791eda0e1e758fb078bec027522d1..6ad8bad2a32012dd40b966a0d75206669b909ab3 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -224,7 +233,7 @@ T tmain(T argc) {
   foo();
 #pragma omp taskgroup task_reduction(+:fl)
 {
-#pragma omp taskloop simd in_reduction(+ : fl)
+#pragma omp taskloop simd allocate(omp_thread_mem_alloc: fl) in_reduction(+ : fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp taskgroup task_reduction(*:fl) // expected-note 2 {{previously marked as task_reduction with different reduction operation}}
index 912e033024e41b3fd7d29369bb01a0e32d49c8a5..ec0d071a1d51c242d296896ae56441b9859cbb9a 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -123,7 +132,7 @@ int foomain(int argc, char **argv) {
   {
     int v = 0;
     int i;
-#pragma omp taskloop simd lastprivate(i)
+#pragma omp taskloop simd lastprivate(i) allocate(omp_thread_mem_alloc: i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}}
     for (int k = 0; k < argc; ++k) {
       i = k;
       v += i;
index bf566e8ef299e14f61da403209fddc81c94a1d76..05b08d6d75c99121aff8a596cde695e126924b3f 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 namespace X {
   int x;
 };
@@ -148,7 +157,7 @@ template<class I, class C> int foomain(I argc, C **argv) {
   {
     int v = 0;
     int i;
-    #pragma omp taskloop simd linear(v:i)
+    #pragma omp taskloop simd allocate(omp_thread_mem_alloc: v) linear(v:i) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}}
     for (int k = 0; k < argc; ++k) { i = k; v += i; }
   }
   #pragma omp taskloop simd linear(ref(j))
index 3e654d3fc177e728097ba8584e6a40a7df575b6a..4198c891c23e1405fdb86e0438387294c524654a 100644 (file)
@@ -2,7 +2,16 @@
 
 // RUN: %clang_cc1 -verify -fopenmp-simd %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -59,7 +68,7 @@ public:
 
   S6() : a(0) {}
   S6(T v) : a(v) {
-#pragma omp taskloop simd private(a) private(this->a)
+#pragma omp taskloop simd allocate(omp_thread_mem_alloc: a) private(a) private(this->a) // expected-warning {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}}
     for (int k = 0; k < v; ++k)
       ++this->a;
   }
@@ -177,7 +186,7 @@ using A::x;
 int main(int argc, char **argv) {
   S4 e(4);
   S5 g(5);
-  S6<float> s6(0.0) , s6_0(1.0);
+  S6<float> s6(0.0) , s6_0(1.0); // expected-note {{in instantiation of member function 'S6<float>::S6' requested here}}
   S7<S6<float> > s7(0.0) , s7_0(1.0);
   int i;
   int &j = i;
index 0257cccba379289e0e0d4f123bb32378d3290dff..dc3a389fc0dfc16443782e9159d5f356631c4301 100644 (file)
@@ -6,7 +6,16 @@
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++98 -ferror-limit 150 -o - %s
 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s
 
-extern int omp_default_mem_alloc;
+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;
+extern const omp_allocator_handle_t omp_const_mem_alloc;
+extern const omp_allocator_handle_t omp_high_bw_mem_alloc;
+extern const omp_allocator_handle_t omp_low_lat_mem_alloc;
+extern const omp_allocator_handle_t omp_cgroup_mem_alloc;
+extern const omp_allocator_handle_t omp_pteam_mem_alloc;
+extern const omp_allocator_handle_t omp_thread_mem_alloc;
+
 void foo() {
 }
 
@@ -192,7 +201,7 @@ T tmain(T argc) {
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel private(fl)
-#pragma omp taskloop simd reduction(+ : fl)
+#pragma omp taskloop simd reduction(+ : fl) allocate(omp_thread_mem_alloc: fl) // expected-warning 2 {{allocator with the 'thread' trait access has unspecified behavior on 'taskloop simd' directive}}
   for (int i = 0; i < 10; ++i)
     foo();
 #pragma omp parallel reduction(* : fl)