config.cc (m68hc11, [...]): Add usegas.h, rename tmake_file to m68hc11/t-m68hc11.
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / reduction3.f90
blob89b9d1af695a928cd96c76a496f46b67da067fbe
1 ! { dg-do run }
2 !$ use omp_lib
4 integer (kind = 4) :: i, ia (6), n, cnt
5 real :: r, ra (4)
6 double precision :: d, da (5)
7 logical :: v
9 i = 1
10 ia = 2
11 r = 3
12 ra = 4
13 d = 5.5
14 da = 6.5
15 v = .false.
16 cnt = -1
18 !$omp parallel num_threads (3) private (n) reduction (.or.:v) &
19 !$omp & reduction (max:i, ia, r, ra, d, da)
20 !$ if (i .ne. -huge(i)-1 .or. any (ia .ne. -huge(ia)-1)) v = .true.
21 !$ if (r .ge. -1.0d38 .or. any (ra .ge. -1.0d38)) v = .true.
22 !$ if (d .ge. -1.0d300 .or. any (da .ge. -1.0d300)) v = .true.
23 n = omp_get_thread_num ()
24 if (n .eq. 0) then
25 cnt = omp_get_num_threads ()
26 i = 4
27 ia(3:5) = -2
28 ia(1) = 7
29 r = 5
30 ra(1:2) = 6.5
31 d = -2.5
32 da(2:4) = 8.5
33 else if (n .eq. 1) then
34 i = 2
35 ia(4:6) = 5
36 r = 1
37 ra(2:4) = -1.5
38 d = 8.5
39 da(1:3) = 2.5
40 else
41 i = 1
42 ia = 1
43 r = -1
44 ra = -1
45 d = 1
46 da = -1
47 end if
48 !$omp end parallel
49 if (v) call abort
50 if (cnt .eq. 3) then
51 if (i .ne. 4 .or. any (ia .ne. (/7, 2, 2, 5, 5, 5/))) call abort
52 if (r .ne. 5 .or. any (ra .ne. (/6.5, 6.5, 4., 4./))) call abort
53 if (d .ne. 8.5 .or. any (da .ne. (/6.5, 8.5, 8.5, 8.5, 6.5/))) call abort
54 end if
56 i = 1
57 ia = 2
58 r = 3
59 ra = 4
60 d = 5.5
61 da = 6.5
62 v = .false.
63 cnt = -1
65 !$omp parallel num_threads (3) private (n) reduction (.or.:v) &
66 !$omp & reduction (min:i, ia, r, ra, d, da)
67 !$ if (i .ne. 2147483647 .or. any (ia .ne. 2147483647)) v = .true.
68 !$ if (r .le. 1.0d38 .or. any (ra .le. 1.0d38)) v = .true.
69 !$ if (d .le. 1.0d300 .or. any (da .le. 1.0d300)) v = .true.
70 n = omp_get_thread_num ()
71 if (n .eq. 0) then
72 cnt = omp_get_num_threads ()
73 i = 4
74 ia(3:5) = -2
75 ia(1) = 7
76 r = 5
77 ra(1:2) = 6.5
78 d = -2.5
79 da(2:4) = 8.5
80 else if (n .eq. 1) then
81 i = 2
82 ia(4:6) = 5
83 r = 1
84 ra(2:4) = -1.5
85 d = 8.5
86 da(1:3) = 2.5
87 else
88 i = 1
89 ia = 1
90 r = -1
91 ra = 7
92 ra(3) = -8.5
93 d = 1
94 da(1:4) = 6
95 end if
96 !$omp end parallel
97 if (v) call abort
98 if (cnt .eq. 3) then
99 if (i .ne. 1 .or. any (ia .ne. (/1, 1, -2, -2, -2, 1/))) call abort
100 if (r .ne. -1 .or. any (ra .ne. (/4., -1.5, -8.5, -1.5/))) call abort
101 if (d .ne. -2.5 .or. any (da .ne. (/2.5, 2.5, 2.5, 6., 6.5/))) call abort
102 end if