1 ! REQUIRES: openmp_runtime
3 ! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=52
5 ! Check OpenMP construct validity for the following directives:
6 ! 2.14.7 Declare Target Directive
8 module declare_target01
10 type my_type(kind_param
, len_param
)
11 integer, KIND
:: kind_param
12 integer, LEN
:: len_param
17 type(my_type(2, 4)) :: my_var
, my_var2
18 integer :: arr(10), arr2(10)
19 integer(kind
=4) :: x
, x2
20 character(len
=32) :: w
, w2
21 integer, dimension(:), allocatable
:: y
, y2
23 !$omp declare target (my_var)
25 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
26 !$omp declare target (my_var%t_i)
28 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
29 !$omp declare target (my_var%t_arr)
31 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
32 !$omp declare target (my_var%kind_param)
34 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
35 !$omp declare target (my_var%len_param)
37 !$omp declare target (arr)
39 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
40 !$omp declare target (arr(1))
42 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
43 !$omp declare target (arr(1:2))
45 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
46 !$omp declare target (x%KIND)
48 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
49 !$omp declare target (w%LEN)
51 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
52 !$omp declare target (y%KIND)
54 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
55 !$omp declare target to (my_var)
57 !$omp declare target enter (my_var)
59 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
60 !$omp declare target to (my_var) device_type(host)
62 !$omp declare target enter (my_var) device_type(host)
64 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
65 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
66 !$omp declare target to (my_var%t_i)
68 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
69 !$omp declare target enter (my_var%t_i)
71 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
72 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
73 !$omp declare target to (my_var%t_arr)
75 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
76 !$omp declare target enter (my_var%t_arr)
78 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
79 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
80 !$omp declare target to (my_var%kind_param)
82 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
83 !$omp declare target enter (my_var%kind_param)
85 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
86 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
87 !$omp declare target to (my_var%len_param)
89 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
90 !$omp declare target enter (my_var%len_param)
92 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
93 !$omp declare target to (arr)
95 !$omp declare target enter (arr)
97 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
98 !$omp declare target to (arr) device_type(nohost)
100 !$omp declare target enter (arr) device_type(nohost)
102 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
103 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
104 !$omp declare target to (arr(1))
106 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
107 !$omp declare target enter (arr(1))
109 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
110 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
111 !$omp declare target to (arr(1:2))
113 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
114 !$omp declare target enter (arr(1:2))
116 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
117 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
118 !$omp declare target to (x%KIND)
120 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
121 !$omp declare target enter (x%KIND)
123 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
124 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
125 !$omp declare target to (w%LEN)
127 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
128 !$omp declare target enter (w%LEN)
130 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
131 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead.
132 !$omp declare target to (y%KIND)
134 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
135 !$omp declare target enter (y%KIND)
137 !$omp declare target link (my_var2)
139 !$omp declare target link (my_var2) device_type(any)
141 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
142 !$omp declare target link (my_var2%t_i)
144 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
145 !$omp declare target link (my_var2%t_arr)
147 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
148 !$omp declare target link (my_var2%kind_param)
150 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
151 !$omp declare target link (my_var2%len_param)
153 !$omp declare target link (arr2)
155 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
156 !$omp declare target link (arr2(1))
158 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
159 !$omp declare target link (arr2(1:2))
161 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
162 !$omp declare target link (x2%KIND)
164 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
165 !$omp declare target link (w2%LEN)
167 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
168 !$omp declare target link (y2%KIND)