Debian Codegraph @

libgomp/testsuite/libgomp.fortran/unroll-5.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-g" }
3
4 module test_functions
5 contains
6 integer function compute_sum4 (step,n) result(sum)
7 implicit none
8 integer :: i, step, n
9
10 sum = 0
11 !$omp parallel do reduction(+:sum) private(i)
12 !$omp unroll partial(5)
13 do i = 1,n,step
14 sum = sum + 1
15 end do
16 end function compute_sum4
17 end module test_functions
18
19 program test
20 use test_functions
21 implicit none
22 integer :: result
23
24 result = compute_sum4 (1, 100)
25 if (result .ne. 100) then
26 stop 1
27 end if
28
29 result = compute_sum4 (1, 9)
30 if (result .ne. 9) then
31 stop 2
32 end if
33
34 result = compute_sum4 (2, 96)
35 if (result .ne. 48) then
36 stop 3
37 end if
38
39 result = compute_sum4 (-2, -98)
40 if (result .ne. 50) then
41 stop 4
42 end if
43
44 result = compute_sum4 (-2, -100)
45 if (result .ne. 51) then
46 stop 5
47 end if
48 end program