1subroutine foo()
2  !$omp declare target  to(foo) device_type(bar)  ! { dg-error "Expected HOST, NOHOST or ANY" }
3end
4
5subroutine bar()
6  !$omp declare target  to(bar) device_type(nohost)
7  !$omp declare target  to(bar) device_type(host)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
8end
9
10module mymod_one
11  implicit none
12  integer :: a, b, c, d, e ,f
13  integer :: m, n, o, p, q, r
14  common /block1/ m, n
15  common /block2/ o, p
16  common /block3/ q, r
17  !$omp declare target  to(a) device_type(nohost)
18  !$omp declare target  to(b) device_type(any)
19  !$omp declare target  to(c) device_type(host)
20  !$omp declare target  link(d) device_type(nohost)
21  !$omp declare target  link(e) device_type(any)
22  !$omp declare target  link(f) device_type(host)
23
24  !$omp declare target  to(c) device_type(host)
25  !$omp declare target  link(d) device_type(nohost)
26end module
27
28module mtest
29  use mymod_one ! { dg-error "Cannot change attributes of USE-associated symbol" }
30  implicit none
31
32  !$omp declare target  to(a) device_type(any)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
33  !$omp declare target  to(b) device_type(host)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
34  !$omp declare target  to(c) device_type(nohost)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
35  !$omp declare target  link(d) device_type(host)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
36  !$omp declare target  link(e) device_type(nohost)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
37  !$omp declare target  link(f) device_type(any)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
38end module
39
40module mymod
41  implicit none
42  integer :: a, b, c, d, e ,f
43  integer :: m, n, o, p, q, r
44  common /block1/ m, n
45  common /block2/ o, p
46  common /block3/ q, r
47  !$omp declare target  to(a) device_type(nohost)
48  !$omp declare target  to(b) device_type(any)
49  !$omp declare target  to(c) device_type(host)
50  !$omp declare target  link(d) device_type(nohost)
51  !$omp declare target  link(e) device_type(any)
52  !$omp declare target  link(f) device_type(host)
53
54  !$omp declare target  to(c) device_type(host)
55  !$omp declare target  link(d) device_type(nohost)
56
57  !$omp declare target  to(a) device_type(any)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
58  !$omp declare target  to(b) device_type(host)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
59  !$omp declare target  to(c) device_type(nohost)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
60  !$omp declare target  link(d) device_type(host)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
61  !$omp declare target  link(e) device_type(nohost)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
62  !$omp declare target  link(f) device_type(any)  ! { dg-error "previous OMP DECLARE TARGET directive to a different DEVICE_TYPE" }
63end
64