The use_device_ptr patch (which needed reviewing) is needed for that test. I bundled all the new tests into one commit, but forgot to exclude that particular test. I will post and push that patch a little later.

Kwok

On 31/01/2019 5:20 pm, Thomas Schwinge wrote:
Hi Kwok!

On Wed, 30 Jan 2019 22:24:48 +0000, Kwok Cheung Yeung <k...@codesourcery.com> 
wrote:
diff --git
a/libgomp/testsuite/libgomp.oacc-fortran/optional-host_data.f90
b/libgomp/testsuite/libgomp.oacc-fortran/optional-host_data.f90
new file mode 100644

I'm seeing this one fail at run time: "libgomp: use_device_ptr pointer
wasn't mapped".  Is this expected (and should thus be XFAILed), or
unexpected?


Grüße
  Thomas


--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-fortran/optional-host_data.f90
@@ -0,0 +1,37 @@
+! Test the host_data construct with optional arguments.
+! Based on host_data-1.f90.
+
+! { dg-do run }
+! { dg-additional-options "-cpp" }
+
+program test
+  implicit none
+
+  integer, target :: i
+  integer, pointer :: ip, iph
+
+  ! Assign the same targets
+  ip => i
+  iph => i
+
+  call foo(iph)
+  call foo(iph, ip)
+contains
+  subroutine foo(iph, ip)
+    integer, pointer :: iph
+    integer, pointer, optional :: ip
+
+    !$acc data copyin(i)
+    !$acc host_data use_device(ip)
+
+    ! Test how the pointers compare inside a host_data construct
+#if ACC_MEM_SHARED
+    if (present(ip) .and. .not. associated(ip, iph)) STOP 1
+#else
+    if (present(ip) .and. associated(ip, iph)) STOP 2
+#endif
+
+    !$acc end host_data
+    !$acc end data
+  end subroutine foo
+end program test

Reply via email to