brintos

brintos / llvm-project-archived public Read only

0
0
Text · 9.3 KiB · 5146ed8 Raw
207 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp -fopenmp-version=522! OpenMP Version 5.13! Check OpenMP construct validity for the following directives:4! 2.14.7 Declare Target Directive5 6program declare_target027  integer :: arr1(10), arr1_to(10), arr1_link(10)8  common /blk1/ a1, a1_to, a1_link9  real, save :: eq_a, eq_b, eq_c, eq_d10 11 12  !$omp declare target (arr1)13 14  !$omp declare target (blk1)15 16  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block17  !$omp declare target (a1)18 19  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]20  !$omp declare target to (arr1_to)21 22  !$omp declare target enter (arr1_to)23 24  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]25  !$omp declare target to (blk1_to)26 27  !$omp declare target enter (blk1_to)28 29  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]30  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block31  !$omp declare target to (a1_to)32 33  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block34  !$omp declare target enter (a1_to)35 36  !$omp declare target link (arr1_link)37 38  !$omp declare target link (blk1_link)39 40  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block41  !$omp declare target link (a1_link)42 43  equivalence(eq_a, eq_b)44  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement45  !$omp declare target (eq_a)46 47  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]48  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement49  !$omp declare target to (eq_a)50 51  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement52  !$omp declare target enter (eq_a)53 54  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement55  !$omp declare target link (eq_b)56 57  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement58  !$omp declare target (eq_c)59 60  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]61  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement62  !$omp declare target to (eq_c)63 64  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement65  !$omp declare target enter (eq_c)66 67  !ERROR: A variable in a DECLARE TARGET directive cannot appear in an EQUIVALENCE statement68  !$omp declare target link (eq_d)69  equivalence(eq_c, eq_d)70 71contains72  subroutine func()73    integer :: arr2(10), arr2_to(10), arr2_link(10)74    integer, save :: arr3(10), arr3_to(10), arr3_link(10)75    common /blk2/ a2, a2_to, a2_link76    common /blk3/ a3, a3_to, a3_link77    save /blk3/78 79    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly80    !$omp declare target (arr2)81 82    !$omp declare target (arr3)83 84    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block85    !$omp declare target (a2)86 87    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block88    !$omp declare target (a3)89 90    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]91    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly92    !$omp declare target to (arr2_to)93 94    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly95    !$omp declare target enter (arr2_to)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 (arr3_to)99 100    !$omp declare target enter (arr3_to)101 102    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]103    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block104    !$omp declare target to (a2_to)105 106    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block107    !$omp declare target enter (a2_to)108 109    !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]110    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block111    !$omp declare target to (a3_to)112 113    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block114    !$omp declare target enter (a3_to)115 116    !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly117    !$omp declare target link (arr2_link)118 119    !$omp declare target link (arr3_link)120 121    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block122    !$omp declare target link (a2_link)123 124    !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block125    !$omp declare target link (a3_link)126  end127end128 129module mod4130  integer :: arr4(10), arr4_to(10), arr4_link(10)131  common /blk4/ a4, a4_to, a4_link132 133  !$omp declare target (arr4)134 135  !$omp declare target (blk4)136 137  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block138  !$omp declare target (a4)139 140  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]141  !$omp declare target to (arr4_to)142 143  !$omp declare target enter (arr4_to)144 145  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]146  !$omp declare target to (blk4_to)147  !$omp declare target enter (blk4_to)148 149  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]150  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block151  !$omp declare target to (a4_to)152 153  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block154  !$omp declare target enter (a4_to)155 156  !$omp declare target link (arr4_link)157 158  !$omp declare target link (blk4_link)159 160  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block161  !$omp declare target link (a4_link)162end163 164subroutine func5()165  integer :: arr5(10), arr5_to(10), arr5_link(10)166  common /blk5/ a5, a5_to, a5_link167 168  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly169  !$omp declare target (arr5)170 171  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly172  !$omp declare target (blk5)173 174  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block175  !$omp declare target (a5)176 177  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]178  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly179  !$omp declare target to (arr5_to)180  181  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly182  !$omp declare target enter (arr5_to)183 184  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]185  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly186  !$omp declare target to (blk5_to)187 188  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly189  !$omp declare target enter (blk5_to)190 191  !WARNING: The usage of TO clause on DECLARE TARGET directive has been deprecated. Use ENTER clause instead. [-Wopen-mp-usage]192  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block193  !$omp declare target to (a5_to)194 195  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block196  !$omp declare target enter (a5_to)197 198  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly199  !$omp declare target link (arr5_link)200 201  !ERROR: A variable that appears in a DECLARE TARGET directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly202  !$omp declare target link (blk5_link)203 204  !ERROR: A variable in a DECLARE TARGET directive cannot be an element of a common block205  !$omp declare target link (a5_link)206end207