1! Test the host_data construct with optional arguments. 2! Based on host_data-1.f90. 3 4! { dg-do run } 5! { dg-additional-options "-cpp" } 6 7program test 8 implicit none 9 10 integer, target :: i 11 integer, pointer :: ip, iph 12 13 ! Assign the same targets 14 ip => i 15 iph => i 16 17 call foo(iph) 18 call foo(iph, ip) 19contains 20 subroutine foo(iph, ip) 21 integer, pointer :: iph 22 integer, pointer, optional :: ip 23 24 !$acc data copyin(i) 25 !$acc host_data use_device(ip) 26 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 35 36 !$acc end host_data 37 !$acc end data 38 end subroutine foo 39end program test 40