1! REQUIRES: openmp_runtime 2 3! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags -fopenmp-version=52 4! OpenMP Version 5.1 5! Check OpenMP construct validity for the following directives: 6! 2.14.7 Declare Target Directive 7 8module declare_target01 9 use omp_lib 10 type my_type(kind_param, len_param) 11 integer, KIND :: kind_param 12 integer, LEN :: len_param 13 integer :: t_i 14 integer :: t_arr(10) 15 end type my_type 16 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 22 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 directive 26 !$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 directive 29 !$omp declare target (my_var%t_arr) 30 31 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 32 !$omp declare target (my_var%kind_param) 33 34 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 35 !$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 directive 40 !$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 directive 43 !$omp declare target (arr(1:2)) 44 45 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 46 !$omp declare target (x%KIND) 47 48 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 49 !$omp declare target (w%LEN) 50 51 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 52 !$omp declare target (y%KIND) 53 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) 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. 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 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) 67 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) 70 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) 74 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) 77 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) 81 82 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 83 !$omp declare target enter (my_var%kind_param) 84 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) 88 89 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 90 !$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. 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. 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 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)) 105 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)) 108 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)) 112 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)) 115 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) 119 120 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 121 !$omp declare target enter (x%KIND) 122 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) 126 127 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 128 !$omp declare target enter (w%LEN) 129 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) 133 134 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 135 !$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 directive 142 !$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 directive 145 !$omp declare target link (my_var2%t_arr) 146 147 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 148 !$omp declare target link (my_var2%kind_param) 149 150 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 151 !$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 directive 156 !$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 directive 159 !$omp declare target link (arr2(1:2)) 160 161 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 162 !$omp declare target link (x2%KIND) 163 164 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 165 !$omp declare target link (w2%LEN) 166 167 !ERROR: A type parameter inquiry cannot appear on the DECLARE TARGET directive 168 !$omp declare target link (y2%KIND) 169end 170