Fix gcc.c-torture/execute/ieee/cdivchkf.c on hpux
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-fortran / optional-host_data.f90
bloba6e41e28b0b3c14056211066bfa8136051ad0a7c
1 ! Test the host_data construct with optional arguments.
2 ! Based on host_data-1.f90.
4 ! { dg-do run }
5 ! { dg-additional-options "-cpp" }
7 program test
8 implicit none
10 integer, target :: i
11 integer, pointer :: ip, iph
13 ! Assign the same targets
14 ip => i
15 iph => i
17 call foo(iph)
18 call foo(iph, ip)
19 contains
20 subroutine foo(iph, ip)
21 integer, pointer :: iph
22 integer, pointer, optional :: ip
24 !$acc data copyin(i)
25 !$acc host_data use_device(ip)
27 ! Test how the pointers compare inside a host_data construct
28 if (present(ip)) then
29 #if ACC_MEM_SHARED
30 if (.not. associated(ip, iph)) STOP 1
31 #else
32 if (associated(ip, iph)) STOP 2
33 #endif
34 end if
36 !$acc end host_data
37 !$acc end data
38 end subroutine foo
39 end program test