1 ! Test optional arguments in reduction clauses. The effect of
2 ! non-present arguments in reduction clauses is undefined, and is not tested
3 ! for. The tests are based on those in reduction-1.f90.
7 ! { dg-additional-options -Wuninitialized }
10 ! { dg-xfail-run-if TODO { openacc_radeon_accel_selected && { ! __OPTIMIZE__ } } }
12 program optional_reduction
15 integer :: rg
, rw
, rv
, rc
22 call do_test(rg
, rw
, rv
, rc
)
24 subroutine do_test(rg
, rw
, rv
, rc
)
25 integer, parameter :: n
= 10, ng
= 8, nw
= 4, vl
= 32
26 integer, optional
:: rg
, rw
, rv
, rc
28 integer, dimension (n
) :: array
35 !$acc parallel num_gangs(ng) copy(rg)
36 !$acc loop reduction(+:rg) gang
37 ! { dg-bogus {'rg\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
38 ! { dg-note {'rg\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
44 !$acc parallel num_workers(nw) copy(rw)
45 !$acc loop reduction(+:rw) worker
46 ! { dg-bogus {'rw\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
47 ! { dg-note {'rw\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
53 !$acc parallel vector_length(vl) copy(rv)
54 !$acc loop reduction(+:rv) vector
55 ! { dg-bogus {'rv\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
56 ! { dg-note {'rv\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
62 !$acc parallel num_gangs(ng) num_workers(nw) vector_length(vl) copy(rc)
63 !$acc loop reduction(+:rc) gang worker vector
64 ! { dg-bogus {'rc\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
65 ! { dg-note {'rc\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
73 vresult
= vresult
+ array(i
)
76 if (rg
.ne
. vresult
) STOP 1
77 if (rw
.ne
. vresult
) STOP 2
78 if (rv
.ne
. vresult
) STOP 3
79 if (rc
.ne
. vresult
) STOP 4
80 end subroutine do_test
81 end program optional_reduction