3 ! { dg-additional-options -Wuninitialized }
5 ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
6 ! aspects of that functionality.
11 integer, parameter :: n
= 40, c
= 10
12 integer :: i
, vsum
, gs
, ws
, vs
, cs
, ns
14 call redsub_gang (gs
, n
, c
)
15 call redsub_worker (ws
, n
, c
)
16 call redsub_vector (vs
, n
, c
)
17 call redsub_combined (cs
, n
, c
)
18 call redsub_nested (ns
, n
, c
)
27 if (gs
.ne
. vsum
) STOP 1
28 if (ws
.ne
. vsum
) STOP 2
29 if (vs
.ne
. vsum
) STOP 3
30 if (cs
.ne
. vsum
) STOP 4
31 if (ns
.ne
. vsum
) STOP 5
34 subroutine redsub_gang(sum
, n
, c
)
39 !$acc parallel copyin (n, c) num_gangs(n) copy(sum)
40 !$acc loop reduction(+:sum) gang
41 ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
42 ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
47 end subroutine redsub_gang
49 subroutine redsub_worker(sum
, n
, c
)
54 !$acc parallel copyin (n, c) num_workers(4) vector_length (32) copy(sum)
55 ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 }
56 !$acc loop reduction(+:sum) worker
57 ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
58 ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
63 end subroutine redsub_worker
65 subroutine redsub_vector(sum
, n
, c
)
70 !$acc parallel copyin (n, c) vector_length(32) copy(sum)
71 !$acc loop reduction(+:sum) vector
72 ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
73 ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
78 end subroutine redsub_vector
80 subroutine redsub_combined(sum
, n
, c
)
85 !$acc parallel num_gangs (8) num_workers (4) vector_length(32) copy(sum)
86 !$acc loop reduction(+:sum) gang worker vector
87 ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
88 ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
93 end subroutine redsub_combined
95 subroutine redsub_nested(sum
, n
, c
)
103 !$acc parallel num_gangs (8) copy(sum)
104 !$acc loop reduction(+:sum) gang
105 ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
106 ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
108 !$acc loop reduction(+:sum) vector
109 ! { dg-bogus {'sum\.[0-9]+' may be used uninitialized} TODO { xfail { ! __OPTIMIZE__ } } .-1 }
110 ! { dg-note {'sum\.[0-9]+' was declared here} {} { target { ! __OPTIMIZE__ } } .-2 }
116 end subroutine redsub_nested