[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenMP / omp-declare-target01.f90
blob862b4c5866f3fb66ee25f806ffb3d5155853d4aa
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2 ! OpenMP Version 5.1
3 ! Check OpenMP construct validity for the following directives:
4 ! 2.14.7 Declare Target Directive
6 module declare_target01
7 use omp_lib
8 type my_type(kind_param, len_param)
9 integer, KIND :: kind_param
10 integer, LEN :: len_param
11 integer :: t_i
12 integer :: t_arr(10)
13 end type my_type
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)