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/taskloop_simd_in_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/taskloop_simd_in_reduction_messages.cpp')
-rw-r--r-- | clang/test/OpenMP/taskloop_simd_in_reduction_messages.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/test/OpenMP/taskloop_simd_in_reduction_messages.cpp b/clang/test/OpenMP/taskloop_simd_in_reduction_messages.cpp index 8d62ec8f49d..6ad8bad2a32 100644 --- a/clang/test/OpenMP/taskloop_simd_in_reduction_messages.cpp +++ b/clang/test/OpenMP/taskloop_simd_in_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() { } @@ -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}} |