aboutsummaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2019-12-09 12:40:17 +0100
committerThomas Schwinge <tschwinge@gcc.gnu.org>2019-12-09 12:40:17 +0100
commit7d02047320b1d47e4ab82d96dcb88dfe410e9be0 (patch)
treec27124f0bc336e67ebf6005ddeec267f25736663 /libgomp
parent1e1fb715cda5ddbc208b32ac0d3fe9e1e4a4f8f9 (diff)
downloadgcc-7d02047320b1d47e4ab82d96dcb88dfe410e9be0.zip
gcc-7d02047320b1d47e4ab82d96dcb88dfe410e9be0.tar.gz
gcc-7d02047320b1d47e4ab82d96dcb88dfe410e9be0.tar.bz2
[PR92854] Add 'libgomp.oacc-c-c++-common/pr92854-1.c'
... to document the status quo. libgomp/ PR libgomp/92854 * testsuite/libgomp.oacc-c-c++-common/pr92854-1.c: New file. From-SVN: r279120
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog3
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/pr92854-1.c31
2 files changed, 34 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6ef2f24..aac3b18 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,8 @@
2019-12-09 Thomas Schwinge <thomas@codesourcery.com>
+ PR libgomp/92854
+ * testsuite/libgomp.oacc-c-c++-common/pr92854-1.c: New file.
+
* testsuite/libgomp.oacc-c-c++-common/host_data-6.c: New file.
* target.c (gomp_exit_data): Use 'gomp_remove_var'.
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr92854-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr92854-1.c
new file mode 100644
index 0000000..6ba96b6
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr92854-1.c
@@ -0,0 +1,31 @@
+/* Verify that 'acc_unmap_data' unmaps even in presence of dynamic reference
+ counts. */
+
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <openacc.h>
+
+int
+main ()
+{
+ const int N = 180;
+
+ char *h = (char *) malloc (N);
+ char *d = (char *) acc_malloc (N);
+ if (!d)
+ abort ();
+ acc_map_data (h, d, N);
+
+ char *d_ = (char *) acc_create (h + 3, N - 77);
+ assert (d_ == d + 3);
+
+ d_ = (char *) acc_create (h, N);
+ assert (d_ == d);
+
+ acc_unmap_data (h);
+ assert (!acc_is_present (h, N));
+
+ return 0;
+}