1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
3 ! Check OpenMP construct validity for the following directives:
4 ! 2.14.7 Declare Target Directive
6 module declare_target01
8 type my_type(kind_param
, len_param
)
9 integer, KIND
:: kind_param
10 integer, LEN
:: len_param
15 type(my_type(2, 4)) :: my_var
, my_var2
16 integer :: arr(10), arr2(10)
17 integer(kind
=4) :: x
, x2
18 character(len
=32) :: w
, w2
19 integer, dimension(:), allocatable
:: y
, y2
21 !$omp declare target (my_var)
23 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
24 !$omp declare target (my_var%t_i)
26 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
27 !$omp declare target (my_var%t_arr)
29 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
30 !$omp declare target (my_var%kind_param)
32 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
33 !$omp declare target (my_var%len_param)
35 !$omp declare target (arr)
37 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
38 !$omp declare target (arr(1))
40 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
41 !$omp declare target (arr(1:2))
43 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
44 !$omp declare target (x%KIND)
46 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
47 !$omp declare target (w%LEN)
49 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
50 !$omp declare target (y%KIND)
52 !$omp declare target to (my_var)
54 !$omp declare target to (my_var) device_type(host)
56 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
57 !$omp declare target to (my_var%t_i)
59 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
60 !$omp declare target to (my_var%t_arr)
62 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
63 !$omp declare target to (my_var%kind_param)
65 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
66 !$omp declare target to (my_var%len_param)
68 !$omp declare target to (arr)
70 !$omp declare target to (arr) device_type(nohost)
72 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
73 !$omp declare target to (arr(1))
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 to (arr(1:2))
78 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
79 !$omp declare target to (x%KIND)
81 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
82 !$omp declare target to (w%LEN)
84 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
85 !$omp declare target to (y%KIND)
87 !$omp declare target link (my_var2)
89 !$omp declare target link (my_var2) device_type(any)
91 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
92 !$omp declare target link (my_var2%t_i)
94 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
95 !$omp declare target link (my_var2%t_arr)
97 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
98 !$omp declare target link (my_var2%kind_param)
100 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
101 !$omp declare target link (my_var2%len_param)
103 !$omp declare target link (arr2)
105 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
106 !$omp declare target link (arr2(1))
108 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive
109 !$omp declare target link (arr2(1:2))
111 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
112 !$omp declare target link (x2%KIND)
114 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
115 !$omp declare target link (w2%LEN)
117 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive
118 !$omp declare target link (y2%KIND)