[PR92854] Add 'libgomp.oacc-c-c++-common/pr92854-1.c'
diff mbox series

Message ID 87lfrl3ee5.fsf@euler.schwinge.homeip.net
State New
Headers show
Series
  • [PR92854] Add 'libgomp.oacc-c-c++-common/pr92854-1.c'
Related show

Commit Message

Thomas Schwinge Dec. 9, 2019, 11:52 a.m. UTC
Hi!

See attached "[PR92854] Add 'libgomp.oacc-c-c++-common/pr92854-1.c'",
committed to trunk in r279120, "to document the status quo", which does
match my understanding of the OpenACC 2.6 semantics.


Grüße
 Thomas

Patch
diff mbox series

From e14bd9d202bc4140d825a396ddaf64a5930ee3d1 Mon Sep 17 00:00:00 2001
From: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Mon, 9 Dec 2019 11:40:17 +0000
Subject: [PATCH] [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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@279120 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                             |  3 ++
 .../libgomp.oacc-c-c++-common/pr92854-1.c     | 31 +++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/pr92854-1.c

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 6ef2f24e4d5..aac3b1887b0 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 00000000000..6ba96b6bf8f
--- /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;
+}
-- 
2.17.1