Merge from mainline
[official-gcc.git] / libgomp / testsuite / libgomp.fortran / reduction5.f90
blobbfdd43a93fa332e46456dab2a5f38bb83a3654a4
1 ! { dg-do run }
3 module reduction5
4 intrinsic ior, min, max
5 end module reduction5
7 call test1
8 call test2
9 contains
10 subroutine test1
11 use reduction5, bitwise_or => ior
12 integer :: n
13 n = Z'f'
14 !$omp parallel sections num_threads (3) reduction (bitwise_or: n)
15 n = ior (n, Z'20')
16 !$omp section
17 n = bitwise_or (Z'410', n)
18 !$omp section
19 n = bitwise_or (n, Z'2000')
20 !$omp end parallel sections
21 if (n .ne. Z'243f') call abort
22 end subroutine
23 subroutine test2
24 use reduction5, min => max, max => min
25 integer :: m, n
26 m = 8
27 n = 4
28 !$omp parallel sections num_threads (3) reduction (min: n) &
29 !$omp & reduction (max: m)
30 if (m .gt. 13) m = 13
31 if (n .lt. 11) n = 11
32 !$omp section
33 if (m .gt. 5) m = 5
34 if (n .lt. 15) n = 15
35 !$omp section
36 if (m .gt. 3) m = 3
37 if (n .lt. -1) n = -1
38 !$omp end parallel sections
39 if (m .ne. 3 .or. n .ne. 15) call abort
40 end subroutine test2
41 end