diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-28 19:15:36 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-03-28 19:15:36 +0000 |
commit | 471171c4c94ced4b0421049d6949c13bdce256f7 (patch) | |
tree | 87f2b2613af4be365f5667dab1e5d8321747f8f7 /clang/test/OpenMP/target_parallel_reduction_messages.cpp | |
parent | ceb3de5d25668f78b27f8d7e9f1d541eb6cd4ce2 (diff) | |
download | bcm5719-llvm-471171c4c94ced4b0421049d6949c13bdce256f7.tar.gz bcm5719-llvm-471171c4c94ced4b0421049d6949c13bdce256f7.zip |
[OPENMP]Add check for undefined behavior with thread allocators on
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.
llvm-svn: 357205
Diffstat (limited to 'clang/test/OpenMP/target_parallel_reduction_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/target_parallel_reduction_messages.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/test/OpenMP/target_parallel_reduction_messages.cpp b/clang/test/OpenMP/target_parallel_reduction_messages.cpp index 01a9d01b7e0..eca57a8cce7 100644 --- a/clang/test/OpenMP/target_parallel_reduction_messages.cpp +++ b/clang/test/OpenMP/target_parallel_reduction_messages.cpp @@ -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) |