aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c-c++-common/alloc-10.c
diff options
context:
space:
mode:
authorMarcel Vollweiler <marcel@codesourcery.com>2021-10-11 04:34:51 -0700
committerMarcel Vollweiler <marcel@codesourcery.com>2021-10-11 04:34:51 -0700
commitf70977936a306e2fb4140361ba47bf5d5cc0a47d (patch)
treeedd1bc720eefa9625fd4bedfa4dbe06373186dd5 /libgomp/testsuite/libgomp.c-c++-common/alloc-10.c
parent07dd3bcda17f97cf5476c3d6f2f2501c1e0712e6 (diff)
downloadgcc-f70977936a306e2fb4140361ba47bf5d5cc0a47d.zip
gcc-f70977936a306e2fb4140361ba47bf5d5cc0a47d.tar.gz
gcc-f70977936a306e2fb4140361ba47bf5d5cc0a47d.tar.bz2
libgomp: Add tests for omp_atv_serialized and deprecate omp_atv_sequential.
The variable omp_atv_sequential was replaced by omp_atv_serialized in OpenMP 5.1. This was already implemented by Jakub (C/C++, commit ea82325afec) and Tobias (Fortran, commit fff15bad1ab). This patch adds two tests to check if omp_atv_serialized is available (one test for C/C++ and one for Fortran). Besides that omp_atv_sequential is marked as deprecated in C/C++ and Fortran for OpenMP 5.1. libgomp/ChangeLog: * allocator.c (omp_init_allocator): Replace omp_atv_sequential with omp_atv_serialized. * omp.h.in: Add deprecated flag for omp_atv_sequential. * omp_lib.f90.in: Add deprecated flag for omp_atv_sequential. * testsuite/libgomp.c-c++-common/alloc-10.c: New test. * testsuite/libgomp.fortran/alloc-12.f90: New test.
Diffstat (limited to 'libgomp/testsuite/libgomp.c-c++-common/alloc-10.c')
-rw-r--r--libgomp/testsuite/libgomp.c-c++-common/alloc-10.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c-c++-common/alloc-10.c b/libgomp/testsuite/libgomp.c-c++-common/alloc-10.c
new file mode 100644
index 0000000..01ae150d
--- /dev/null
+++ b/libgomp/testsuite/libgomp.c-c++-common/alloc-10.c
@@ -0,0 +1,25 @@
+#include <omp.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+const omp_alloctrait_t traits[]
+= { { omp_atk_alignment, 64 },
+ { omp_atk_sync_hint, omp_atv_serialized },
+ { omp_atk_fallback, omp_atv_null_fb } };
+
+int
+main ()
+{
+ omp_allocator_handle_t a;
+ int *volatile p;
+ a = omp_init_allocator (omp_default_mem_space, 3, traits);
+ if (a == omp_null_allocator)
+ abort ();
+ p = (int *) omp_alloc (3072, a);
+ if ((((uintptr_t) p) % 64) != 0)
+ abort ();
+ p[0] = 1;
+ p[3071 / sizeof (int)] = 2;
+ omp_free (p, a);
+ omp_destroy_allocator (a);
+}