Debian Codegraph @

flang/test/Semantics/OpenMP/threadprivate01.f90

raw
1 ! REQUIRES: openmp_runtime
2
3 ! RUN: %python %S/../test_errors.py %s %flang_fc1 %openmp_flags
4 ! OpenMP Version 5.1
5 ! Check OpenMP construct validity for the following directives:
6 ! 2.21.2 Threadprivate Directive
7
8 module thread_private01
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
18 integer :: arr(10)
19 integer(kind=4) :: x
20 character(len=32) :: w
21 integer, dimension(:), allocatable :: y
22
23 !$omp threadprivate(my_var)
24
25 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
26 !$omp threadprivate(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 THREADPRIVATE directive
29 !$omp threadprivate(my_var%t_arr)
30
31 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
32 !$omp threadprivate(my_var%kind_param)
33
34 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
35 !$omp threadprivate(my_var%len_param)
36
37 !$omp threadprivate(arr)
38
39 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
40 !$omp threadprivate(arr(1))
41
42 !ERROR: A variable that is part of another variable (as an array or structure element) cannot appear on the THREADPRIVATE directive
43 !$omp threadprivate(arr(1:2))
44
45 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
46 !$omp threadprivate(x%KIND)
47
48 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
49 !$omp threadprivate(w%LEN)
50
51 !ERROR: A type parameter inquiry cannot appear on the THREADPRIVATE directive
52 !$omp threadprivate(y%KIND)
53 end