88 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 5.13! Check OpenMP construct validity for the following directives:4! 2.21.2 Threadprivate Directive5 6program threadprivate027 integer :: arr1(10)8 common /blk1/ a19 real, save :: eq_a, eq_b, eq_c, eq_d10 integer :: eq_e, eq_f11 equivalence(eq_e, eq_f)12 common /blk2/ eq_e13 14 !$omp threadprivate(arr1)15 16 !$omp threadprivate(/blk1/)17 18 !$omp threadprivate(blk1)19 20 !ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block21 !$omp threadprivate(a1)22 23 equivalence(eq_a, eq_b)24 !ERROR: A variable in a THREADPRIVATE directive cannot appear in an EQUIVALENCE statement25 !$omp threadprivate(eq_a)26 27 !ERROR: A variable in a THREADPRIVATE directive cannot appear in an EQUIVALENCE statement28 !$omp threadprivate(eq_c)29 equivalence(eq_c, eq_d)30 31 !ERROR: A variable in a THREADPRIVATE directive cannot appear in an EQUIVALENCE statement (variable 'eq_e' from common block '/blk2/')32 !$omp threadprivate(/blk2/)33 34contains35 subroutine func()36 integer :: arr2(10)37 integer, save :: arr3(10)38 common /blk2/ a239 common /blk3/ a340 save /blk3/41 42 !ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly43 !$omp threadprivate(arr2)44 45 !$omp threadprivate(arr3)46 47 !$omp threadprivate(/blk2/)48 49 !ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block50 !$omp threadprivate(a2)51 52 !$omp threadprivate(/blk3/)53 54 !ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block55 !$omp threadprivate(a3)56 end57end58 59module mod460 integer :: arr4(10)61 common /blk4/ a462 63 !$omp threadprivate(arr4)64 65 !$omp threadprivate(/blk4/)66 67 !$omp threadprivate(blk4)68 69 !ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block70 !$omp threadprivate(a4)71end72 73subroutine func5()74 integer :: arr5(10)75 common /blk5/ a576 77 !ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly78 !$omp threadprivate(arr5)79 80 !$omp threadprivate(/blk5/)81 82 !ERROR: A variable that appears in a THREADPRIVATE directive must be declared in the scope of a module or have the SAVE attribute, either explicitly or implicitly83 !$omp threadprivate(blk5)84 85 !ERROR: A variable in a THREADPRIVATE directive cannot be an element of a common block86 !$omp threadprivate(a5)87end88