64 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -fopenacc2module m3 real, device :: a(4,8)4 real, managed, allocatable :: b(:,:)5 integer, constant :: x = 16 type :: int7 real :: i, s 8 end type int9 interface operator (+)10 module procedure addHost11 module procedure addDevice12 end interface operator (+)13 contains14 attributes(global) subroutine kernel(a,b,c,n,m)15 integer, value :: n16 integer, intent(in) :: m17 real a(n,m), c(n,m)18 real, managed :: b(n,m)19 end20 attributes(device) subroutine devsub(a,n)21 integer, value :: n22 real, device :: a(n)23 end24 subroutine test25 real c(4)26 allocate(b(4,8))27 !ERROR: dummy argument 'm=' has ATTRIBUTES(DEVICE) but its associated actual argument has no CUDA data attribute28 call kernel<<<1,32>>>(a,b,b,4,8)29 !$acc parallel loop copy(c)30 do j = 1, 131 call devsub(c,4) ! not checked in OpenACC construct32 end do33 end34 attributes(global) subroutine sub1(x)35 integer :: x36 end37 subroutine sub2()38 call sub1<<<1,1>>>(x) ! actual constant to device dummy39 end40 function addHost(a, b) result(c)41 type(int), intent(in) :: a, b42 type(int) :: c43 end function addHost44 attributes(device) function addDevice(a, b) result(c)45 type(int), device :: c46 type(int), intent(in) :: a ,b47 end function addDevice48 attributes(global) subroutine overload(c, a, b)49 type (int) :: c, a, b50 c = a+b ! ok resolve to addDevice51 end subroutine overload52 53 attributes(host,device) subroutine hostdev(a)54 integer :: a(*)55 end subroutine56 57 subroutine host()58 integer :: a(10)59 call hostdev(a) ! ok because hostdev is attributes(host,device)60 end subroutine61 62 63end64