170 lines · plain
1! REQUIRES: openmp_runtime2 3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=524! OpenMP Version 5.15! Check OpenMP construct validity for the following directives:6! 2.14.7 Declare Target Directive7 8module declare_target019 use omp_lib10 type my_type(kind_param, len_param)11 integer, KIND :: kind_param12 integer, LEN :: len_param13 integer :: t_i14 integer :: t_arr(10)15 end type my_type16 17 type(my_type(2, 4)) :: my_var, my_var218 integer :: arr(10), arr2(10)19 integer(kind=4) :: x, x220 character(len=32) :: w, w221 integer, dimension(:), allocatable :: y, y222 23 !$omp declare target (my_var)24 25 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive26 !$omp declare target (my_var%t_i)27 28 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive29 !$omp declare target (my_var%t_arr)30 31 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive32 !$omp declare target (my_var%kind_param)33 34 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive35 !$omp declare target (my_var%len_param)36 37 !$omp declare target (arr)38 39 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive40 !$omp declare target (arr(1))41 42 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive43 !$omp declare target (arr(1:2))44 45 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive46 !$omp declare target (x%KIND)47 48 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive49 !$omp declare target (w%LEN)50 51 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive52 !$omp declare target (y%KIND)53 54 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]55 !$omp declare target to (my_var)56 57 !$omp declare target enter (my_var)58 59 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]60 !$omp declare target to (my_var) device_type(host)61 62 !$omp declare target enter (my_var) device_type(host)63 64 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive65 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]66 !$omp declare target to (my_var%t_i)67 68 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive69 !$omp declare target enter (my_var%t_i)70 71 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive72 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]73 !$omp declare target to (my_var%t_arr)74 75 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive76 !$omp declare target enter (my_var%t_arr)77 78 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive79 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]80 !$omp declare target to (my_var%kind_param)81 82 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive83 !$omp declare target enter (my_var%kind_param)84 85 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive86 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]87 !$omp declare target to (my_var%len_param)88 89 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive90 !$omp declare target enter (my_var%len_param)91 92 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]93 !$omp declare target to (arr)94 95 !$omp declare target enter (arr)96 97 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]98 !$omp declare target to (arr) device_type(nohost)99 100 !$omp declare target enter (arr) device_type(nohost)101 102 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive103 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]104 !$omp declare target to (arr(1))105 106 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive107 !$omp declare target enter (arr(1))108 109 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive110 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]111 !$omp declare target to (arr(1:2))112 113 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive114 !$omp declare target enter (arr(1:2))115 116 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive117 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]118 !$omp declare target to (x%KIND)119 120 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive121 !$omp declare target enter (x%KIND)122 123 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive124 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]125 !$omp declare target to (w%LEN)126 127 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive128 !$omp declare target enter (w%LEN)129 130 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive131 !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]132 !$omp declare target to (y%KIND)133 134 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive135 !$omp declare target enter (y%KIND)136 137 !$omp declare target link (my_var2)138 139 !$omp declare target link (my_var2) device_type(any)140 141 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive142 !$omp declare target link (my_var2%t_i)143 144 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive145 !$omp declare target link (my_var2%t_arr)146 147 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive148 !$omp declare target link (my_var2%kind_param)149 150 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive151 !$omp declare target link (my_var2%len_param)152 153 !$omp declare target link (arr2)154 155 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive156 !$omp declare target link (arr2(1))157 158 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the DECLARE TARGET directive159 !$omp declare target link (arr2(1:2))160 161 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive162 !$omp declare target link (x2%KIND)163 164 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive165 !$omp declare target link (w2%LEN)166 167 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive168 !$omp declare target link (y2%KIND)169end170