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_teams_distribute_simd_firstprivate_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_teams_distribute_simd_firstprivate_messages.cpp')
| -rw-r--r-- | clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp b/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp index 65c854281d7..1ce3adc74d6 100644 --- a/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp +++ b/clang/test/OpenMP/target_teams_distribute_simd_firstprivate_messages.cpp @@ -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'}} |

