2 ! { dg-require-effective-target tls_runtime }
5 integer, dimension(:,:), pointer :: foo => NULL()
6 !$omp threadprivate (foo)
7 end module threadprivate3
12 integer, dimension(:), pointer :: bar1
13 integer, dimension(2), target :: bar2, var
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)
33 !$omp parallel num_threads (4) reduction (.or.:l)
34 bar2 = omp_get_thread_num ()
37 l = l.or..not.associated (bar1)
38 l = l.or..not.associated (bar1, bar2)
39 l = l.or.any (bar1.ne.omp_get_thread_num ())
41 l = l.or.associated (bar1)
43 l = l.or..not.associated (bar3)
44 bar3 = omp_get_thread_num () - 2
45 if (omp_get_thread_num () .ne. 0) then
47 if (associated (bar3)) call abort
51 bar2 = omp_get_thread_num () * 6 + 130
53 l = l.or.(baz%b.ne.32)
54 baz%a = omp_get_thread_num () * 2
55 baz%b = omp_get_thread_num () * 2 + 1
59 if (.not.associated (bar1)) call abort
60 if (any (bar1.ne.6)) call abort
61 if (.not.associated (bar3)) call abort
62 if (any (bar3 .ne. -2)) call abort
64 if (associated (bar3)) call abort
69 !$omp parallel copyin (bar1, bar2, bar3, baz) num_threads (4) &
70 !$omp& reduction (.or.:l)
71 l = l.or..not.associated (bar1)
72 l = l.or.any (bar1.ne.6)
73 l = l.or.any (bar2.ne.130)
74 l = l.or..not.associated (bar3)
75 l = l.or.size (bar3).ne.10
76 l = l.or.any (bar3.ne.17)
78 bar1 = omp_get_thread_num ()
79 bar2 = omp_get_thread_num () + 8
83 baz%a = omp_get_thread_num () * 3 + 4
84 baz%b = omp_get_thread_num () * 3 + 5
87 if (omp_get_thread_num () .eq. 0) then
93 l = l.or..not.associated (bar1)
94 l = l.or..not.associated (bar3)
95 l = l.or.any (bar1.ne.omp_get_thread_num ())
96 l = l.or.size (bar1).ne.4
97 l = l.or.any (bar2.ne.omp_get_thread_num () + 8)
98 l = l.or.any (bar3.ne.omp_get_thread_num () + 8)
99 l = l.or.size (bar3).ne.2
101 l = l.or.(baz%a .ne. omp_get_thread_num () * 3 + 4)
102 l = l.or.(baz%b .ne. omp_get_thread_num () * 3 + 5)
108 ! { dg-final { cleanup-modules "threadprivate3" } }