Debian Codegraph @

gcc/testsuite/gfortran.dg/gomp/adjust-args-11.f90

raw
1 ! { dg-do compile }
2
3 ! Check that the OpenMP syntax with commas between clauses is supported.
4 ! A comma after the directive name is introduced in 5.2, which currently is only
5 ! partially supported.
6
7 module main
8 use iso_c_binding, only: c_ptr
9 implicit none
10
11 type :: struct
12 integer :: a
13 real :: b
14 end type
15
16 interface
17 integer function f(a, b, c)
18 import c_ptr
19 integer, intent(in) :: a
20 type(c_ptr), intent(inout) :: b
21 type(c_ptr), intent(out) :: c
22 end function
23 integer function f0(a, b, c)
24 import c_ptr
25 integer, intent(in) :: a
26 type(c_ptr), intent(inout) :: b
27 type(c_ptr), intent(out) :: c
28 !$omp declare variant (f), match (construct={dispatch}) , &
29 !$omp& adjust_args (nothing: a) ,adjust_args (need_device_ptr: b),adjust_args (need_device_ptr: c)
30 end function
31 end interface
32
33 contains
34 subroutine test
35 integer :: a
36 type(c_ptr) :: b
37 type(c_ptr) :: c(2)
38 type(struct) :: s
39
40 !!$omp dispatch, nocontext(.false.), novariants(.false.) ! Not supported yet
41 !$omp dispatch nocontext(.false.), novariants(.false.)
42 s%a = f0 (a, b, c)
43
44 end subroutine
45 end module
46
47 module other
48 use iso_c_binding, only: c_ptr
49 implicit none
50
51 interface
52 integer function g(a, b, c)
53 import c_ptr
54 integer, intent(in) :: a
55 type(c_ptr), intent(inout) :: b
56 type(c_ptr), intent(out) :: c(:)
57 end function
58 integer function g0(a, b, c) ! { dg-error "Argument 'c' at .1. to list item in 'need_device_ptr' at .2. must be a scalar of TYPE\\(C_PTR\\)" }
59 import c_ptr
60 integer, intent(in) :: a
61 type(c_ptr), intent(inout) :: b
62 type(c_ptr), intent(out) :: c(:)
63 !$omp declare variant (g), match (construct={dispatch}) , &
64 !$omp& adjust_args (nothing: a) ,adjust_args (need_device_ptr: b),adjust_args (need_device_ptr: c) ! { dg-error "Argument 'c' at .1. to list item in 'need_device_ptr' at .2. must be a scalar of TYPE\\(C_PTR\\)" }
65 ! { dg-note "Consider using 'need_device_addr' instead" "" { target *-*-* } .-1 }
66 end function
67 end interface
68 end module
69
70 subroutine foobar
71 use iso_c_binding, only: c_ptr
72 implicit none
73
74 interface
75 integer function h(a, b, c)
76 import c_ptr
77 integer, intent(in) :: a
78 type(c_ptr), intent(inout) :: b
79 type(c_ptr), intent(out) :: c(:)
80 end function
81 integer function h0(a, b, c) ! { dg-error "Argument 'c' at .1. to list item in 'need_device_ptr' at .2. must be a scalar of TYPE\\(C_PTR\\)" }
82 import c_ptr
83 integer, intent(in) :: a
84 type(c_ptr), intent(inout) :: b
85 type(c_ptr), intent(out) :: c(:)
86 !$omp declare variant (h), match (construct={dispatch}) , &
87 !$omp& adjust_args (nothing: a) ,adjust_args (need_device_ptr: b),adjust_args (need_device_ptr: c) ! { dg-error "Argument 'c' at .1. to list item in 'need_device_ptr' at .2. must be a scalar of TYPE\\(C_PTR\\)" }
88 ! { dg-note "Consider using 'need_device_addr' instead" "" { target *-*-* } .-1 }
89 end function
90 end interface
91 end
92
93
94 subroutine outer
95 contains
96 subroutine inner
97 use iso_c_binding, only: c_ptr
98 implicit none
99
100 interface
101 integer function st(a, b, c)
102 import c_ptr
103 integer, intent(in) :: a
104 type(c_ptr), intent(inout) :: b
105 type(c_ptr), intent(out) :: c(:)
106 end function
107 integer function st0(a, b, c) ! { dg-error "Argument 'c' at .1. to list item in 'need_device_ptr' at .2. must be a scalar of TYPE\\(C_PTR\\)" }
108 import c_ptr
109 integer, intent(in) :: a
110 type(c_ptr), intent(inout) :: b
111 type(c_ptr), intent(out) :: c(:)
112 !$omp declare variant (st), match (construct={dispatch}) , &
113 !$omp& adjust_args (nothing: a) ,adjust_args (need_device_ptr: b),adjust_args (need_device_ptr: c) ! { dg-error "Argument 'c' at .1. to list item in 'need_device_ptr' at .2. must be a scalar of TYPE\\(C_PTR\\)" }
114 ! { dg-note "Consider using 'need_device_addr' instead" "" { target *-*-* } .-1 }
115 end function
116 end interface
117 end subroutine inner
118 end subroutine outer