PR c++/86342 - -Wdeprecated-copy and system headers.
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / lastprivate1.f90
blob132617b5c2730e7f20fbb729bc5267091e2d906e
1 program lastprivate
2 integer :: i
3 common /c/ i
4 !$omp parallel num_threads (4)
5 call test1
6 !$omp end parallel
7 if (i .ne. 21) STOP 1
8 !$omp parallel num_threads (4)
9 call test2
10 !$omp end parallel
11 if (i .ne. 64) STOP 2
12 !$omp parallel num_threads (4)
13 call test3
14 !$omp end parallel
15 if (i .ne. 14) STOP 3
16 call test4
17 call test5
18 call test6
19 call test7
20 call test8
21 call test9
22 call test10
23 call test11
24 call test12
25 contains
26 subroutine test1
27 integer :: i
28 common /c/ i
29 !$omp do lastprivate (i)
30 do i = 1, 20
31 end do
32 end subroutine test1
33 subroutine test2
34 integer :: i
35 common /c/ i
36 !$omp do lastprivate (i)
37 do i = 7, 61, 3
38 end do
39 end subroutine test2
40 function ret3 ()
41 integer :: ret3
42 ret3 = 3
43 end function ret3
44 subroutine test3
45 integer :: i
46 common /c/ i
47 !$omp do lastprivate (i)
48 do i = -10, 11, ret3 ()
49 end do
50 end subroutine test3
51 subroutine test4
52 integer :: j
53 !$omp parallel do lastprivate (j) num_threads (4) default (none)
54 do j = 1, 20
55 end do
56 if (j .ne. 21) STOP 4
57 end subroutine test4
58 subroutine test5
59 integer :: j
60 !$omp parallel do lastprivate (j) num_threads (4) default (none)
61 do j = 7, 61, 3
62 end do
63 if (j .ne. 64) STOP 5
64 end subroutine test5
65 subroutine test6
66 integer :: j
67 !$omp parallel do lastprivate (j) num_threads (4) default (none)
68 do j = -10, 11, ret3 ()
69 end do
70 if (j .ne. 14) STOP 6
71 end subroutine test6
72 subroutine test7
73 integer :: i
74 common /c/ i
75 !$omp parallel do lastprivate (i) num_threads (4) default (none)
76 do i = 1, 20
77 end do
78 if (i .ne. 21) STOP 7
79 end subroutine test7
80 subroutine test8
81 integer :: i
82 common /c/ i
83 !$omp parallel do lastprivate (i) num_threads (4) default (none)
84 do i = 7, 61, 3
85 end do
86 if (i .ne. 64) STOP 8
87 end subroutine test8
88 subroutine test9
89 integer :: i
90 common /c/ i
91 !$omp parallel do lastprivate (i) num_threads (4) default (none)
92 do i = -10, 11, ret3 ()
93 end do
94 if (i .ne. 14) STOP 9
95 end subroutine test9
96 subroutine test10
97 integer :: i
98 common /c/ i
99 !$omp parallel num_threads (4) default (none) shared (i)
100 !$omp do lastprivate (i)
101 do i = 1, 20
102 end do
103 !$omp end parallel
104 if (i .ne. 21) STOP 10
105 end subroutine test10
106 subroutine test11
107 integer :: i
108 common /c/ i
109 !$omp parallel num_threads (4) default (none) shared (i)
110 !$omp do lastprivate (i)
111 do i = 7, 61, 3
112 end do
113 !$omp end parallel
114 if (i .ne. 64) STOP 11
115 end subroutine test11
116 subroutine test12
117 integer :: i
118 common /c/ i
119 !$omp parallel num_threads (4) default (none) shared (i)
120 !$omp do lastprivate (i)
121 do i = -10, 11, ret3 ()
122 end do
123 !$omp end parallel
124 if (i .ne. 14) STOP 12
125 end subroutine test12
126 end program lastprivate