| 1 |
! { dg-do compile } |
| 2 |
|
| 3 |
program main |
| 4 |
integer, parameter :: N = 10 |
| 5 |
integer, dimension(N) :: a |
| 6 |
integer, dimension(N) :: b |
| 7 |
integer, dimension(N) :: c |
| 8 |
integer :: i |
| 9 |
|
| 10 |
do i = 1, N |
| 11 |
a(i) = i * 2 |
| 12 |
b(i) = i * 3 |
| 13 |
end do |
| 14 |
|
| 15 |
!$omp metadirective & |
| 16 |
!$omp& default (teams loop) & |
| 17 |
!$omp& default (parallel loop) ! { dg-error "too many 'otherwise' or 'default' clauses in 'metadirective' at .1." } |
| 18 |
do i = 1, N |
| 19 |
c(i) = a(i) * b(i) |
| 20 |
end do |
| 21 |
|
| 22 |
!$omp metadirective & |
| 23 |
!$omp& otherwise (teams loop) & |
| 24 |
!$omp& default (parallel loop) ! { dg-error "too many 'otherwise' or 'default' clauses in 'metadirective' at .1." } |
| 25 |
do i = 1, N |
| 26 |
c(i) = a(i) * b(i) |
| 27 |
end do |
| 28 |
|
| 29 |
!$omp metadirective & |
| 30 |
!$omp& otherwise (teams loop) & |
| 31 |
!$omp& otherwise (parallel loop) ! { dg-error "too many 'otherwise' or 'default' clauses in 'metadirective' at .1." } |
| 32 |
do i = 1, N |
| 33 |
c(i) = a(i) * b(i) |
| 34 |
end do |
| 35 |
|
| 36 |
!$omp metadirective default (xyz) ! { dg-error "Unclassifiable OpenMP directive at .1." } |
| 37 |
do i = 1, N |
| 38 |
c(i) = a(i) * b(i) |
| 39 |
end do |
| 40 |
|
| 41 |
!$omp metadirective & |
| 42 |
!$omp& default (teams loop) & |
| 43 |
!$omp& where (device={arch("nvptx")}: parallel loop) ! { dg-error "expected 'when', 'otherwise', or 'default' at .1." } |
| 44 |
do i = 1, N |
| 45 |
c(i) = a(i) * b(i) |
| 46 |
end do |
| 47 |
|
| 48 |
!$omp metadirective & |
| 49 |
!$omp& otherwise (teams loop) & |
| 50 |
!$omp& when (device={arch("nvptx")}: parallel loop) ! { dg-error "'otherwise' or 'default' clause must appear last" } |
| 51 |
do i = 1, N |
| 52 |
c(i) = a(i) * b(i) |
| 53 |
end do |
| 54 |
|
| 55 |
!$omp metadirective & |
| 56 |
!$omp& when (device={arch("nvptx")} parallel loop) & ! { dg-error "expected .:." } |
| 57 |
!$omp& default (teams loop) |
| 58 |
do i = 1, N |
| 59 |
c(i) = a(i) * b(i) |
| 60 |
end do |
| 61 |
|
| 62 |
! Test improperly nested metadirectives - even though the second |
| 63 |
! metadirective resolves to 'omp nothing', that is not the same as there |
| 64 |
! being literally nothing there. |
| 65 |
!$omp metadirective & |
| 66 |
!$omp& when (implementation={vendor("gnu")}: parallel do) |
| 67 |
!$omp metadirective & |
| 68 |
!$omp& when (implementation={vendor("cray")}: parallel do) ! { dg-error "Unexpected !.OMP METADIRECTIVE statement" } |
| 69 |
do i = 1, N |
| 70 |
c(i) = a(i) * b(i) |
| 71 |
end do |
| 72 |
|
| 73 |
!$omp begin metadirective & |
| 74 |
!$omp& when (device={arch("nvptx")}: parallel do) & |
| 75 |
!$omp& default (barrier) ! { dg-error "variant directive used in OMP BEGIN METADIRECTIVE at .1. must have a corresponding end directive" } |
| 76 |
do i = 1, N |
| 77 |
c(i) = a(i) * b(i) |
| 78 |
end do |
| 79 |
!$omp end metadirective ! { dg-error "Unexpected !.OMP END METADIRECTIVE statement at .1." } |
| 80 |
end program |