summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authortschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-26 16:24:44 +0000
committertschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-26 16:24:44 +0000
commitcfe316ad3a766aa93361cec6325a3bc75c310e59 (patch)
tree7c1e10b20f55d7105ac57aed5fdfa1c88960b9ed /libgomp
parent54c8f61c735f98c73033ad04fc5db9062f8ad3a8 (diff)
downloadgcc-cfe316ad3a766aa93361cec6325a3bc75c310e59.tar.gz
libgomp: Additional acc_shutdown bug fixing and testing
libgomp/ * oacc-init.c (acc_shutdown): Call gomp_init_targets_once. * testsuite/libgomp.oacc-c-c++-common/lib-8.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229380 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/ChangeLog3
-rw-r--r--libgomp/oacc-init.c2
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c19
3 files changed, 24 insertions, 0 deletions
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index e99f9241d07..ad970df522f 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,5 +1,8 @@
2015-10-26 Thomas Schwinge <thomas@codesourcery.com>
+ * oacc-init.c (acc_shutdown): Call gomp_init_targets_once.
+ * testsuite/libgomp.oacc-c-c++-common/lib-8.c: New file.
+
PR libgomp/66518
* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Resolve XFAIL.
diff --git a/libgomp/oacc-init.c b/libgomp/oacc-init.c
index a0e62a40cc4..9a9a0b0333f 100644
--- a/libgomp/oacc-init.c
+++ b/libgomp/oacc-init.c
@@ -449,6 +449,8 @@ ialias (acc_init)
void
acc_shutdown (acc_device_t d)
{
+ gomp_init_targets_once ();
+
gomp_mutex_lock (&acc_device_lock);
acc_shutdown_1 (d);
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c
new file mode 100644
index 00000000000..ea28b6bacf9
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c
@@ -0,0 +1,19 @@
+/* Expect error message when shutting down a device that has never been
+ initialized. */
+/* { dg-do run } */
+
+#include <stdio.h>
+#include <openacc.h>
+
+int
+main (int argc, char **argv)
+{
+ fprintf (stderr, "CheCKpOInT\n");
+ acc_shutdown (acc_device_default);
+
+ return 0;
+}
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "no device initialized" } */
+/* { dg-shouldfail "" } */