| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fopenmp" } |
| 3 |
|
| 4 |
module m |
| 5 |
integer :: a |
| 6 |
integer, parameter :: X = 1 |
| 7 |
integer, parameter :: Y = 2 |
| 8 |
|
| 9 |
! Indirect on a variable should have no effect. |
| 10 |
integer :: z |
| 11 |
!$omp declare target to (z) indirect |
| 12 |
contains |
| 13 |
subroutine sub1 |
| 14 |
!$omp declare target indirect to (sub1) |
| 15 |
end subroutine |
| 16 |
|
| 17 |
subroutine sub2 |
| 18 |
!$omp declare target enter (sub2) indirect (.true.) |
| 19 |
end subroutine |
| 20 |
|
| 21 |
subroutine sub3 |
| 22 |
!$omp declare target to (sub3) indirect (.false.) |
| 23 |
end subroutine |
| 24 |
|
| 25 |
subroutine sub4 |
| 26 |
!$omp declare target to (sub4) indirect (1) ! { dg-error "INDIRECT clause at .1. requires a constant logical expression" } |
| 27 |
end subroutine |
| 28 |
|
| 29 |
! Compile-time non-constant expressions are not allowed. |
| 30 |
subroutine sub5 |
| 31 |
!$omp declare target indirect (a > 0) to (sub5) ! { dg-error "INDIRECT clause at .1. requires a constant logical expression" } |
| 32 |
end subroutine |
| 33 |
|
| 34 |
! Compile-time constant expressions are permissible. |
| 35 |
subroutine sub6 |
| 36 |
!$omp declare target indirect (X .eq. Y) to (sub6) |
| 37 |
end subroutine |
| 38 |
|
| 39 |
subroutine sub7 |
| 40 |
!$omp declare target indirect ! { dg-warning "OMP DECLARE TARGET directive at .1. with only DEVICE_TYPE or INDIRECT clauses is ignored" } |
| 41 |
end subroutine |
| 42 |
|
| 43 |
subroutine sub8 |
| 44 |
!$omp declare target indirect (.true.) indirect (.false.) to (sub8) ! { dg-error "Duplicated .indirect. clause at .1." } |
| 45 |
end subroutine |
| 46 |
|
| 47 |
subroutine sub9 |
| 48 |
!$omp declare target to (sub9) indirect ("abs") ! { dg-error "INDIRECT clause at .1. requires a constant logical expression" } |
| 49 |
end subroutine |
| 50 |
|
| 51 |
subroutine sub10 |
| 52 |
!$omp declare target to (sub10) indirect (5.5) ! { dg-error "INDIRECT clause at .1. requires a constant logical expression" } |
| 53 |
end subroutine |
| 54 |
|
| 55 |
subroutine sub11 |
| 56 |
!$omp declare target indirect (.true.) device_type (host) enter (sub11) ! { dg-error "DEVICE_TYPE must be ANY when used with INDIRECT at .1." } |
| 57 |
end subroutine |
| 58 |
|
| 59 |
subroutine sub12 |
| 60 |
!$omp declare target indirect (.false.) device_type (nohost) enter (sub12) |
| 61 |
end subroutine |
| 62 |
end module |