aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/gomp
diff options
context:
space:
mode:
authorHafiz Abid Qadeer <abidh@codesourcery.com>2022-02-18 21:28:08 +0000
committerHafiz Abid Qadeer <abidh@codesourcery.com>2022-05-06 10:45:05 +0100
commit1a8c4d9ed36556a95bd7d53c04d2ec4c95594061 (patch)
treed3fb88f1fbe3f66e9c1e85431540fb79131dd8f4 /gcc/testsuite/gcc.dg/gomp
parent8025f29fbd8f87e27354b69d0bc9eb8d1aeae94c (diff)
downloadgcc-1a8c4d9ed36556a95bd7d53c04d2ec4c95594061.zip
gcc-1a8c4d9ed36556a95bd7d53c04d2ec4c95594061.tar.gz
gcc-1a8c4d9ed36556a95bd7d53c04d2ec4c95594061.tar.bz2
Add a restriction on allocate clause (OpenMP 5.0)
An allocate clause in target region must specify an allocator unless the compilation unit has requires construct with dynamic_allocators clause. Current implementation of the allocate clause did not check for this restriction. This patch fills that gap. gcc/ChangeLog: * omp-low.cc (omp_maybe_offloaded_ctx): New prototype. (scan_sharing_clauses): Check a restriction on allocate clause. gcc/testsuite/ChangeLog: * c-c++-common/gomp/allocate-2.c: Add tests. * c-c++-common/gomp/allocate-8.c: New test. * gfortran.dg/gomp/allocate-3.f90: Add tests. * gcc.dg/gomp/pr104517.c: Update.
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp')
-rw-r--r--gcc/testsuite/gcc.dg/gomp/pr104517.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/pr104517.c b/gcc/testsuite/gcc.dg/gomp/pr104517.c
index efb3175..7e3bd1a 100644
--- a/gcc/testsuite/gcc.dg/gomp/pr104517.c
+++ b/gcc/testsuite/gcc.dg/gomp/pr104517.c
@@ -2,11 +2,13 @@
/* { dg-do compile } */
/* { dg-options "-O1 -fcompare-debug -fopenmp -fno-tree-ter -save-temps" } */
-enum {
- omp_default_mem_alloc,
- omp_large_cap_mem_alloc,
- omp_const_mem_alloc,
- omp_high_bw_mem_alloc
+typedef enum omp_allocator_handle_t
+{
+ omp_null_allocator = 0,
+ omp_default_mem_alloc = 1,
+ omp_large_cap_mem_alloc = 2,
+ omp_const_mem_alloc = 3,
+ omp_high_bw_mem_alloc = 4,
} omp_allocator_handle_t;
int t, bar_nte, bar_tl, bar_i3, bar_dd;
@@ -23,7 +25,7 @@ bar (int *idp, int s, int nth, int g, int nta, int fi, int pp, int *q,
int p = 0, i2 = 0, i1 = 0, m = 0, d = 0;
#pragma omp target parallel for \
- device(p) firstprivate (f) allocate (f) in_reduction(+:r2)
+ device(p) firstprivate (f) allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 4; i++)
ll++;
@@ -31,8 +33,8 @@ bar (int *idp, int s, int nth, int g, int nta, int fi, int pp, int *q,
device(d) map (m) \
if (target: p) firstprivate (f) defaultmap(tofrom: scalar) is_device_ptr (idp) \
if (parallel: i2) reduction(+:r) num_threads (nth) linear (ll) \
- schedule(static) collapse(1) nowait depend(inout: d) allocate (f) \
- in_reduction(+:r2)
+ schedule(static) collapse(1) nowait depend(inout: d) \
+ allocate (omp_default_mem_alloc:f) in_reduction(+:r2)
for (int i = 0; i < 4; i++)
ll++;