aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/goacc/declare-2.f95
blob: bad5de9d757df0d11eeb3717e85ae6030a016a41 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82

module amod
  implicit none
  integer :: b(8)

  !$acc declare copy (b) ! { dg-error "Invalid clause in module" }
  !$acc declare copyout (b) ! { dg-error "Invalid clause in module" }
  !$acc declare present (b) ! { dg-error "Invalid clause in module" }
  !$acc declare present_or_copy (b) ! { dg-error "Invalid clause in module" }
  !$acc declare present_or_copyin (b) ! { dg-error "present on multiple" }
  !$acc declare present_or_copyout (b) ! { dg-error "Invalid clause in module" }
  !$acc declare present_or_create (b) ! { dg-error "present on multiple" }
  !$acc declare deviceptr (b) ! { dg-error "Invalid clause in module" }
  !$acc declare create (b) copyin (b) ! { dg-error "present on multiple" }
end module

module amod2
contains
subroutine asubr (a, b, c, d, e, f, g, h, i, j, k)
  implicit none
  integer, dimension(8) :: a, b, c, d, e, f, g, h, i, j, k

  !$acc declare copy (a)
  !$acc declare copyout (b)
  !$acc declare present (c)
  !$acc declare present_or_copy (d)
  !$acc declare present_or_copyin (e)
  !$acc declare present_or_copyout (f)
  !$acc declare present_or_create (g)
  !$acc declare deviceptr (h)
  !$acc declare create (j) copyin (k)
end subroutine
end module

module bmod

  implicit none
  integer :: a, b, c, d, e, f, g, h, i
  common /data1/ a, b, c
  common /data2/ d, e, f
  common /data3/ g, h, i
  !$acc declare link (a) ! { dg-error "element of a COMMON" }
  !$acc declare link (/data1/)
  !$acc declare link (a, b, c) ! { dg-error "element of a COMMON" }
  !$acc declare link (/foo/) ! { dg-error "not found" }
  !$acc declare device_resident (/data2/)
  !$acc declare device_resident (/data3/) ! { dg-error "present on multiple clauses" }
  !$acc declare device_resident (g, h, i)

end module

subroutine bsubr (foo)
  implicit none

  integer, dimension (:) :: foo

  !$acc declare copy (foo) ! { dg-error "Assumed-size dummy array" }
  !$acc declare copy (foo(1:2)) ! { dg-error "Assumed-size dummy array" }

end subroutine bsubr

subroutine multiline
  integer :: b(8)

  !$acc declare copyin (b) ! { dg-error "present on multiple clauses" }
  !$acc declare copyin (b)

end subroutine multiline

subroutine subarray
  integer :: c(8)

  !$acc declare copy (c(1:2)) ! { dg-error "Array sections: 'c' not allowed" }

end subroutine subarray

program test
  integer :: a(8)

  !$acc declare create (a) copyin (a) ! { dg-error "present on multiple clauses" }

end program