From 8baa7864a6ad2680b79b6b80eb223ff2e7db4f48 Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Mon, 26 Oct 2015 17:24:17 +0100
Subject: [PATCH] [PR libgomp/65437, libgomp/66518] Initialize runtime in
 acc_update_device, acc_update_self

	libgomp/
	PR libgomp/65437
	PR libgomp/66518
	* oacc-mem.c (update_dev_host): Call goacc_lazy_initialize.
	* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Remove XFAIL.

From-SVN: r229378
---
 libgomp/ChangeLog                                    | 7 +++++++
 libgomp/oacc-mem.c                                   | 6 +++---
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c | 4 +---
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 658c47b0c133..76cb423e0f4f 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,10 @@
+2015-10-26  Thomas Schwinge  <thomas@codesourcery.com>
+
+	PR libgomp/65437
+	PR libgomp/66518
+	* oacc-mem.c (update_dev_host): Call goacc_lazy_initialize.
+	* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Remove XFAIL.
+
 2015-10-23  Tom de Vries  <tom@codesourcery.com>
 
 	PR testsuite/68063
diff --git a/libgomp/oacc-mem.c b/libgomp/oacc-mem.c
index af067d6e73c0..54109061fb1c 100644
--- a/libgomp/oacc-mem.c
+++ b/libgomp/oacc-mem.c
@@ -547,6 +547,9 @@ update_dev_host (int is_dev, void *h, size_t s)
 {
   splay_tree_key n;
   void *d;
+
+  goacc_lazy_initialize ();
+
   struct goacc_thread *thr = goacc_thread ();
   struct gomp_device_descr *acc_dev = thr->dev;
 
@@ -554,9 +557,6 @@ update_dev_host (int is_dev, void *h, size_t s)
 
   n = lookup_host (acc_dev, h, s);
 
-  /* No need to call lazy open, as the data must already have been
-     mapped.  */
-
   if (!n)
     {
       gomp_mutex_unlock (&acc_dev->lock);
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c
index 95c416254665..de5d1c13cf89 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-42.c
@@ -35,7 +35,5 @@ main (int argc, char **argv)
 }
 
 /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* TODO: currently doesn't print anything; SIGSEGV.
-   <https://gcc.gnu.org/PR66518>.  */
-/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] is not mapped" { xfail *-*-* } } */
+/* { dg-output "\\\[\[0-9a-fA-FxX\]+,256\\\] is not mapped" } */
 /* { dg-shouldfail "" } */
-- 
GitLab