1! { dg-do compile }
2! { dg-options "-fopenacc" }
3! { dg-require-effective-target fopenacc }
4
5! PR fortran/78260
6! Contributed by Gerhard Steinmetz
7
8module m
9  implicit none
10  integer :: n = 0
11contains
12  subroutine s
13    !$acc declare present(m)  ! { dg-error "Object .m. is not a variable" }
14    !$acc kernels copyin(m)   ! { dg-error "Object .m. is not a variable" }
15    n = n + 1
16    !$acc end kernels
17  end subroutine s
18  subroutine s2
19    !$acc declare present(s2)  ! { dg-error "Object .s2. is not a variable" }
20    !$acc kernels copyin(s2)   ! { dg-error "Object .s2. is not a variable" }
21    n = n + 1
22    !$acc end kernels
23  end subroutine s2
24  integer function f1()
25    !$acc declare present(f1)  ! OK, f1 is also the result variable
26    !$acc kernels copyin(f1)   ! OK, f1 is also the result variable
27    f1 = 5
28    !$acc end kernels
29  end function f1
30  integer function f2() result(res)
31    !$acc declare present(f2)  ! { dg-error "Object .f2. is not a variable" }
32    !$acc kernels copyin(f2)   ! { dg-error "Object .f2. is not a variable" }
33    res = 5
34    !$acc end kernels
35  end function f2
36end module m
37