| 1 |
module my_omp_lib |
| 2 |
use iso_c_binding |
| 3 |
implicit none |
| 4 |
|
| 5 |
! The following definitions are in omp_lib, which cannot be included |
| 6 |
! in gcc/testsuite/ |
| 7 |
integer, parameter :: omp_interop_kind = c_intptr_t |
| 8 |
integer, parameter :: omp_interop_fr_kind = c_int |
| 9 |
|
| 10 |
integer (omp_interop_kind), parameter :: omp_interop_none = 0_omp_interop_kind |
| 11 |
integer (omp_interop_fr_kind), parameter :: omp_ifr_cuda = 1 |
| 12 |
integer (omp_interop_fr_kind), parameter :: omp_ifr_cuda_driver = 2 |
| 13 |
integer (omp_interop_fr_kind), parameter :: omp_ifr_opencl = 3 |
| 14 |
integer (omp_interop_fr_kind), parameter :: omp_ifr_sycl = 4 |
| 15 |
integer (omp_interop_fr_kind), parameter :: omp_ifr_hip = 5 |
| 16 |
integer (omp_interop_fr_kind), parameter :: omp_ifr_level_zero = 6 |
| 17 |
integer (omp_interop_fr_kind), parameter :: omp_ifr_hsa = 7 |
| 18 |
end module my_omp_lib |
| 19 |
|
| 20 |
module m |
| 21 |
use my_omp_lib |
| 22 |
implicit none |
| 23 |
logical, parameter :: flag = .true. |
| 24 |
contains |
| 25 |
subroutine f1a () |
| 26 |
end |
| 27 |
|
| 28 |
subroutine f1b () |
| 29 |
end |
| 30 |
|
| 31 |
subroutine f1c () |
| 32 |
end |
| 33 |
|
| 34 |
subroutine f1d () |
| 35 |
end |
| 36 |
|
| 37 |
subroutine f1e () |
| 38 |
end |
| 39 |
|
| 40 |
subroutine f1po (q,r, obj) |
| 41 |
type(c_ptr) :: q, r |
| 42 |
value :: r |
| 43 |
integer(omp_interop_kind),value :: obj |
| 44 |
end |
| 45 |
|
| 46 |
subroutine f2 () |
| 47 |
!$omp declare variant (f1a) match(user={condition(flag)}) & |
| 48 |
!$omp& append_args ( interop ( target , targetsync) ) match(construct={dispatch}) ! { dg-error "'match' clause at .1. specified more than once" } |
| 49 |
end subroutine |
| 50 |
|
| 51 |
subroutine f2a () |
| 52 |
!$omp declare variant (f1b) append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target)) & |
| 53 |
!$omp& append_args ( interop ( target , targetsync) ) match(construct={dispatch}) ! { dg-error "'append_args' clause at .1. specified more than once" } |
| 54 |
end subroutine |
| 55 |
|
| 56 |
|
| 57 |
subroutine f2b () |
| 58 |
!$omp declare variant (f1c) & |
| 59 |
!$omp& append_args ( interop ( target , targetsync) ) ! { dg-error "the 'append_args' clause at .1. can only be specified if the 'dispatch' selector of the construct selector set appears in the 'match' clause" } |
| 60 |
end subroutine |
| 61 |
|
| 62 |
subroutine f2c (x,y) |
| 63 |
!$omp declare variant (fop) , append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target)) , & |
| 64 |
!$omp& adjust_args (need_device_ptr : x, y ) ! { dg-error "the 'adjust_args' clause at .1. can only be specified if the 'dispatch' selector of the construct selector set appears in the 'match' clause" } |
| 65 |
type(c_ptr) :: x, y |
| 66 |
value :: y |
| 67 |
end subroutine |
| 68 |
|
| 69 |
subroutine f2d () |
| 70 |
!$omp declare variant (f1d) append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target)) , ! { dg-error "119: expected 'match', 'adjust_args' or 'append_args' at .1." } |
| 71 |
end subroutine |
| 72 |
|
| 73 |
subroutine f2e () |
| 74 |
!$omp declare variant (f1e) append_args ( interop ( target, prefer_type ( "cuda", "hip" ) ) , interop(target) interop(targetsync)) ! { dg-error "Expected ',' or '\\)' at .1." } |
| 75 |
end subroutine |
| 76 |
end |