libgomp: Additional acc_shutdown bug fixing and testing
authorThomas Schwinge <thomas@codesourcery.com>
Mon, 26 Oct 2015 16:24:44 +0000 (17:24 +0100)
committerThomas Schwinge <tschwinge@gcc.gnu.org>
Mon, 26 Oct 2015 16:24:44 +0000 (17:24 +0100)
libgomp/
* oacc-init.c (acc_shutdown): Call gomp_init_targets_once.
* testsuite/libgomp.oacc-c-c++-common/lib-8.c: New file.

From-SVN: r229380

libgomp/ChangeLog
libgomp/oacc-init.c
libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c [new file with mode: 0644]

index e99f9241d07903bfda824d0fe3a466edcf3da116..ad970df522f86c31cb2f5c24acbe546fb53249d8 100644 (file)
@@ -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.
 
index a0e62a40cc4091ac8263ae57ab503c711e661123..9a9a0b0333f71a634bbcb770b0a213a258fc9ba0 100644 (file)
@@ -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 (file)
index 0000000..ea28b6b
--- /dev/null
@@ -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 "" } */