Debian Codegraph @

gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90

raw
1 ! Test cases of nested 'reduction' clauses expected to compile cleanly.
2
3 ! See also 'c-c++-common/goacc/nested-reductions-1-routine.c'.
4
5 ! { dg-additional-options -Wuninitialized }
6
7 subroutine acc_routine ()
8 implicit none (type, external)
9 !$acc routine gang
10
11 integer :: i, j, k, sum, diff
12
13 ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 }
14 !$acc loop reduction(+:sum)
15 ! { dg-warning {'sum' is used uninitialized} {} { target *-*-* } .-1 }
16 do i = 1, 10
17 do j = 1, 10
18 do k = 1, 10
19 sum = 1
20 end do
21 end do
22 end do
23
24 ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 }
25 !$acc loop collapse(2) reduction(+:sum)
26 do i = 1, 10
27 do j = 1, 10
28 do k = 1, 10
29 sum = 1
30 end do
31 end do
32 end do
33
34 ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 }
35 !$acc loop reduction(+:sum)
36 do i = 1, 10
37 !$acc loop reduction(+:sum)
38 do j = 1, 10
39 do k = 1, 10
40 sum = 1
41 end do
42 end do
43 end do
44
45 ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 }
46 !$acc loop reduction(+:sum)
47 do i = 1, 10
48 !$acc loop collapse(2) reduction(+:sum)
49 do j = 1, 10
50 do k = 1, 10
51 sum = 1
52 end do
53 end do
54 end do
55
56 ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 }
57 !$acc loop reduction(+:sum)
58 do i = 1, 10
59 do j = 1, 10
60 !$acc loop reduction(+:sum)
61 do k = 1, 10
62 sum = 1
63 end do
64 end do
65 end do
66
67 ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 }
68 !$acc loop reduction(+:sum)
69 do i = 1, 10
70 !$acc loop reduction(+:sum)
71 do j = 1, 10
72 !$acc loop reduction(+:sum)
73 do k = 1, 10
74 sum = 1
75 end do
76 end do
77 end do
78
79 ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 }
80 !$acc loop reduction(+:sum) reduction(-:diff)
81 ! { dg-warning {'diff' is used uninitialized} {} { target *-*-* } .-1 }
82 do i = 1, 10
83 !$acc loop reduction(+:sum)
84 do j = 1, 10
85 !$acc loop reduction(+:sum)
86 do k = 1, 10
87 sum = 1
88 end do
89 end do
90
91 !$acc loop reduction(-:diff)
92 do j = 1, 10
93 !$acc loop reduction(-:diff)
94 do k = 1, 10
95 diff = 1
96 end do
97 end do
98 end do
99 end subroutine acc_routine