Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / threadprivate01.f90
blob309d209a456727307190acc61b68d27f7aaaba89
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.21.2 Threadprivate Directive
6 module thread_private01
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
16 integer :: arr(10)
17 integer(kind=4) :: x
18 character(len=32) :: w
19 integer, dimension(:), allocatable :: y
21 !$omp threadprivate(my_var)
23 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
24 !$omp threadprivate(my_var%t_i)
26 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
27 !$omp threadprivate(my_var%t_arr)
29 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
30 !$omp threadprivate(my_var%kind_param)
32 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
33 !$omp threadprivate(my_var%len_param)
35 !$omp threadprivate(arr)
37 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
38 !$omp threadprivate(arr(1))
40 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
41 !$omp threadprivate(arr(1:2))
43 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
44 !$omp threadprivate(x%KIND)
46 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
47 !$omp threadprivate(w%LEN)
49 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
50 !$omp threadprivate(y%KIND)
51 end