Daily bump.
[gcc-git-mirror.git] / libgomp / testsuite / libgomp.fortran / unroll-2.f90
blobd60f97e5648bf79ba49e461735f73cfcd897400a
1 ! { dg-do run }
2 ! { dg-additional-options "-g" }
4 module test_functions
5 contains
6 integer function compute_sum1 () result(sum)
7 implicit none
8 integer :: i
10 sum = 0
11 !$omp unroll full
12 do i = 1,10,3
13 sum = sum + 1
14 end do
15 end function compute_sum1
17 integer function compute_sum2() result(sum)
18 implicit none
19 integer :: i
21 sum = 0
22 !$omp unroll full
23 do i = -20,1,3
24 sum = sum + 1
25 end do
26 end function compute_sum2
28 integer function compute_sum3() result(sum)
29 implicit none
30 integer :: i
32 sum = 0
33 !$omp unroll full
34 do i = 30,1,-3
35 sum = sum + 1
36 end do
37 end function compute_sum3
39 integer function compute_sum4() result(sum)
40 implicit none
41 integer :: i
43 sum = 0
44 !$omp unroll full
45 do i = 50,-60,-10
46 sum = sum + 1
47 end do
48 end function compute_sum4
50 end module test_functions
52 program test
53 use test_functions
54 implicit none
55 integer :: result
57 result = compute_sum1 ()
58 if (result .ne. 4) then
59 stop 1
60 end if
62 result = compute_sum2 ()
63 if (result .ne. 8) then
64 stop 2
65 end if
67 result = compute_sum3 ()
68 if (result .ne. 10) then
69 stop 3
70 end if
72 result = compute_sum4 ()
73 if (result .ne. 12) then
74 stop 4
75 end if
76 end program