2 ! { dg-require-effective-target tls_runtime }
5 integer, dimension(:,:), allocatable
:: foo
6 !$omp threadprivate (foo)
7 end module threadprivate2
12 integer, dimension(:), pointer :: bar1
13 integer, dimension(2), target
:: bar2
14 common /thrc
/ bar1
, bar2
15 !$omp threadprivate (/thrc/)
17 integer, dimension(:), pointer, save :: bar3
=> NULL()
18 !$omp threadprivate (bar3)
25 type (tt
), save :: baz
26 !$omp threadprivate (baz)
29 call omp_set_dynamic (.false
.)
30 call omp_set_num_threads (4)
32 !$omp parallel num_threads (4) reduction (.or.:l)
34 allocate (foo (6 + omp_get_thread_num (), 3))
35 l
= l
.or
..not
.allocated (foo
)
36 l
= l
.or
.size (foo
).ne
.(18 + 3 * omp_get_thread_num ())
37 foo
= omp_get_thread_num () + 1
39 bar2
= omp_get_thread_num ()
40 l
= l
.or
.associated (bar3
)
42 l
= l
.or
..not
.associated (bar1
)
43 l
= l
.or
..not
.associated (bar1
, bar2
)
44 l
= l
.or
.any (bar1
.ne
.omp_get_thread_num ())
46 l
= l
.or
.associated (bar1
)
48 l
= l
.or
..not
.associated (bar3
)
49 bar3
= omp_get_thread_num () - 2
51 l
= l
.or
.(baz
%b
.ne
.32)
52 baz
%a
= omp_get_thread_num () * 2
53 baz
%b
= omp_get_thread_num () * 2 + 1
57 if (.not
.allocated (foo
)) stop 2
58 if (size (foo
).ne
.18) stop 3
59 if (any (foo
.ne
.1)) stop 4
61 if (associated (bar1
)) stop 5
62 if (.not
.associated (bar3
)) stop 6
63 if (any (bar3
.ne
. -2)) stop 7
65 if (associated (bar3
)) stop 8
67 !$omp parallel num_threads (4) reduction (.or.:l)
68 l
= l
.or
..not
.allocated (foo
)
69 l
= l
.or
.size (foo
).ne
.(18 + 3 * omp_get_thread_num ())
70 l
= l
.or
.any (foo
.ne
.(omp_get_thread_num () + 1))
71 if (omp_get_thread_num () .ne
. 0) then
73 l
= l
.or
.allocated (foo
)
76 l
= l
.or
.associated (bar1
)
77 if (omp_get_thread_num () .ne
. 0) then
78 l
= l
.or
..not
.associated (bar3
)
79 l
= l
.or
.any (bar3
.ne
. omp_get_thread_num () - 2)
82 l
= l
.or
.associated (bar3
)
84 l
= l
.or
.(baz
%a
.ne
.(omp_get_thread_num () * 2))
85 l
= l
.or
.(baz
%b
.ne
.(omp_get_thread_num () * 2 + 1))
89 if (.not
.allocated (foo
)) stop 10
90 if (size (foo
).ne
.18) stop 11
91 if (any (foo
.ne
.1)) stop 12
93 if (allocated (foo
)) stop 13
96 ! { dg-final { cleanup-modules "threadprivate2" } }