summaryrefslogtreecommitdiff
path: root/libgomp
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2021-08-26 16:55:21 +0200
committerThomas Schwinge <thomas@codesourcery.com>2022-01-13 11:52:35 +0100
commit4bd8b1e881f0c26a5103cd1919809b3d63b60ef2 (patch)
tree8c6905ae40aa7cdfea7cffed18d4a260b7f291ae /libgomp
parentdb0d23722e8b8daa54203f537729f578f3809c15 (diff)
Document current '-Wuninitialized'/'-Wmaybe-uninitialized' diagnostics for OpenACC test cases
... including "note: '[...]' was declared here" emitted since recent commit 9695e1c23be5b5c55d572ced152897313ddb96ae "Improve -Wuninitialized note location". For those that seemed incorrect to me, I've placed XFAILed 'dg-bogus'es, including one more instance of PR77504 etc., and several instances where for "local variables" of reference-data-type reductions (etc.?) we emit bogus (?) diagnostics. For implicit data clauses (including 'firstprivate'), we seem to be missing diagnostics, so I've placed XFAILed 'dg-warning's. gcc/testsuite/ * c-c++-common/goacc/builtin-goacc-parlevel-id-size.c: Document current '-Wuninitialized' diagnostics. * c-c++-common/goacc/mdc-1.c: Likewise. * c-c++-common/goacc/nested-reductions-1-kernels.c: Likewise. * c-c++-common/goacc/nested-reductions-1-parallel.c: Likewise. * c-c++-common/goacc/nested-reductions-1-routine.c: Likewise. * c-c++-common/goacc/nested-reductions-2-kernels.c: Likewise. * c-c++-common/goacc/nested-reductions-2-parallel.c: Likewise. * c-c++-common/goacc/nested-reductions-2-routine.c: Likewise. * c-c++-common/goacc/uninit-dim-clause.c: Likewise. * c-c++-common/goacc/uninit-firstprivate-clause.c: Likewise. * c-c++-common/goacc/uninit-if-clause.c: Likewise. * gfortran.dg/goacc/array-with-dt-1.f90: Likewise. * gfortran.dg/goacc/array-with-dt-2.f90: Likewise. * gfortran.dg/goacc/array-with-dt-3.f90: Likewise. * gfortran.dg/goacc/array-with-dt-4.f90: Likewise. * gfortran.dg/goacc/array-with-dt-5.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-1.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-2.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-3.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-4.f90: Likewise. * gfortran.dg/goacc/derived-classtypes-1.f95: Likewise. * gfortran.dg/goacc/derived-types-2.f90: Likewise. * gfortran.dg/goacc/host_data-tree.f95: Likewise. * gfortran.dg/goacc/kernels-tree.f95: Likewise. * gfortran.dg/goacc/modules.f95: Likewise. * gfortran.dg/goacc/nested-reductions-1-kernels.f90: Likewise. * gfortran.dg/goacc/nested-reductions-1-parallel.f90: Likewise. * gfortran.dg/goacc/nested-reductions-1-routine.f90: Likewise. * gfortran.dg/goacc/nested-reductions-2-kernels.f90: Likewise. * gfortran.dg/goacc/nested-reductions-2-parallel.f90: Likewise. * gfortran.dg/goacc/nested-reductions-2-routine.f90: Likewise. * gfortran.dg/goacc/parallel-tree.f95: Likewise. * gfortran.dg/goacc/pr93464.f90: Likewise. * gfortran.dg/goacc/privatization-1-compute-loop.f90: Likewise. * gfortran.dg/goacc/privatization-1-compute.f90: Likewise. * gfortran.dg/goacc/privatization-1-routine_gang-loop.f90: Likewise. * gfortran.dg/goacc/privatization-1-routine_gang.f90: Likewise. * gfortran.dg/goacc/uninit-dim-clause.f95: Likewise. * gfortran.dg/goacc/uninit-firstprivate-clause.f95: Likewise. * gfortran.dg/goacc/uninit-if-clause.f95: Likewise. * gfortran.dg/goacc/uninit-use-device-clause.f95: Likewise. * gfortran.dg/goacc/wait.f90: Likewise. libgomp/ * testsuite/libgomp.oacc-c-c++-common/vred2d-128.c: Document current '-Wuninitialized' diagnostics. * testsuite/libgomp.oacc-fortran/data-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/gemm-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/gemm.f90: Likewise. * testsuite/libgomp.oacc-fortran/optional-reduction.f90: Likewise. * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise. * testsuite/libgomp.oacc-fortran/pr70643.f90: Likewise. * testsuite/libgomp.oacc-fortran/pr96628-part1.f90: Likewise. * testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-5.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-7.f90: Likewise. * testsuite/libgomp.oacc-fortran/reference-reductions.f90: Likewise.
Diffstat (limited to 'libgomp')
-rw-r--r--libgomp/testsuite/libgomp.oacc-c-c++-common/vred2d-128.c36
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/data-5.f904
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/gemm-2.f904
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/gemm.f904
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f9010
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f908
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/pr70643.f906
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/pr96628-part1.f905
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f908
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f9014
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/reduction-7.f906
-rw-r--r--libgomp/testsuite/libgomp.oacc-fortran/reference-reductions.f906
12 files changed, 108 insertions, 3 deletions
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/vred2d-128.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/vred2d-128.c
index 86171d456e0..489f26ad9f2 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/vred2d-128.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/vred2d-128.c
@@ -1,5 +1,7 @@
/* Test large vector lengths. */
+/* { dg-additional-options -Wuninitialized } */
+
#include <assert.h>
#define n 10000
@@ -8,7 +10,7 @@ int a1[n], a2[n];
#define gentest(name, outer, inner) \
void name () \
{ \
- long i, j, t1, t2, t3; \
+ long i, j, t1, t2, t3; /* { dg-line vars } */ \
_Pragma(outer) \
for (i = 0; i < n; i++) \
{ \
@@ -32,15 +34,47 @@ int a1[n], a2[n];
gentest (test1, "acc parallel loop gang vector_length (128) firstprivate (t1, t2)",
"acc loop vector reduction(+:t1) reduction(-:t2)")
+/* { dg-warning {'t1' is used uninitialized} {} { target *-*-* } .-1 }
+ { dg-note {'t1' was declared here} {} { target *-*-* } vars }
+ { dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-4 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
+/* { dg-warning {'t2' is used uninitialized} {} { target *-*-* } .-5 }
+ { dg-note {'t2' was declared here} {} { target *-*-* } vars }
+ { DUP_dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-8 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
gentest (test2, "acc parallel loop gang vector_length (128) firstprivate (t1, t2)",
"acc loop worker vector reduction(+:t1) reduction(-:t2)")
+/* { dg-warning {'t1' is used uninitialized} {} { target *-*-* } .-1 }
+ { DUP_dg-note {'t1' was declared here} {} { target *-*-* } vars }
+ { dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-4 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
+/* { dg-warning {'t2' is used uninitialized} {} { target *-*-* } .-5 }
+ { DUP_dg-note {'t2' was declared here} {} { target *-*-* } vars }
+ { DUP_dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-8 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
gentest (test3, "acc parallel loop gang worker vector_length (128) firstprivate (t1, t2)",
"acc loop vector reduction(+:t1) reduction(-:t2)")
+/* { dg-warning {'t1' is used uninitialized} {} { target *-*-* } .-1 }
+ { DUP_dg-note {'t1' was declared here} {} { target *-*-* } vars }
+ { dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-4 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
+/* { dg-warning {'t2' is used uninitialized} {} { target *-*-* } .-5 }
+ { DUP_dg-note {'t2' was declared here} {} { target *-*-* } vars }
+ { DUP_dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-8 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
gentest (test4, "acc parallel loop firstprivate (t1, t2)",
"acc loop reduction(+:t1) reduction(-:t2)")
+/* { dg-warning {'t1' is used uninitialized} {} { target *-*-* } .-1 }
+ { DUP_dg-note {'t1' was declared here} {} { target *-*-* } vars }
+ { dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-4 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
+/* { dg-warning {'t2' is used uninitialized} {} { target *-*-* } .-5 }
+ { DUP_dg-note {'t2' was declared here} {} { target *-*-* } vars }
+ { DUP_dg-note {in expansion of macro 'gentest'} {} { target { ! offloading_enabled } } .-8 }
+ TODO See PR101551 for 'offloading_enabled' differences. */
int
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-5.f90 b/libgomp/testsuite/libgomp.oacc-fortran/data-5.f90
index c68a2795900..37c8457ec1f 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/data-5.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/data-5.f90
@@ -1,6 +1,8 @@
! { dg-do run }
! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
+! { dg-additional-options -Wuninitialized }
+
program refcount_test
use openacc
integer, allocatable :: h(:)
@@ -21,6 +23,8 @@ program refcount_test
call acc_update_self (h)
do i = 1, N
if (h(i) .eq. i) c = c + 1
+ ! { dg-warning {'c' may be used uninitialized} {} { target __OPTIMIZE__ } .-1 }
+ ! { dg-note {'c' was declared here} {} { target __OPTIMIZE__ } .-2 }
end do
! h[] should be filled with uninitialized device values,
! 'stop' if it's not.
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/gemm-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/gemm-2.f90
index 5fa93642477..bc419cf4fa9 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/gemm-2.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/gemm-2.f90
@@ -3,6 +3,8 @@
! { dg-do run }
! { dg-additional-options "-fopenacc-dim=::128" }
+! { dg-additional-options -Wuninitialized }
+
! Implicitly set vector_length to 128 using -fopenacc-dim.
subroutine openacc_sgemm (m, n, k, alpha, a, b, beta, c)
integer :: m, n, k
@@ -11,8 +13,10 @@ subroutine openacc_sgemm (m, n, k, alpha, a, b, beta, c)
integer :: i, j, l
real :: temp
+ ! { dg-note {'temp' was declared here} {} { target *-*-* } .-1 }
!$acc parallel loop copy(c(1:m,1:n)) copyin(a(1:k,1:m),b(1:k,1:n)) firstprivate (temp)
+ ! { dg-warning {'temp' is used uninitialized} {} { target *-*-* } .-1 }
do j = 1, n
!$acc loop
do i = 1, m
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/gemm.f90 b/libgomp/testsuite/libgomp.oacc-fortran/gemm.f90
index 9e8915fbb88..562cb6a7de4 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/gemm.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/gemm.f90
@@ -2,6 +2,8 @@
! { dg-do run }
+! { dg-additional-options -Wuninitialized }
+
! Explicitly set vector_length to 128 using a vector_length clause.
subroutine openacc_sgemm_128 (m, n, k, alpha, a, b, beta, c)
integer :: m, n, k
@@ -10,8 +12,10 @@ subroutine openacc_sgemm_128 (m, n, k, alpha, a, b, beta, c)
integer :: i, j, l
real :: temp
+ ! { dg-note {'temp' was declared here} {} { target *-*-* } .-1 }
!$acc parallel loop copy(c(1:m,1:n)) copyin(a(1:k,1:m),b(1:k,1:n)) vector_length (128) firstprivate (temp)
+ ! { dg-warning {'temp' is used uninitialized} {} { target *-*-* } .-1 }
do j = 1, n
!$acc loop
do i = 1, m
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90 b/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90
index 69b69b66c71..0bb05b9b869 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90
@@ -4,6 +4,8 @@
! { dg-do run }
+! { dg-additional-options -Wuninitialized }
+
!TODO
! { dg-xfail-run-if TODO { openacc_radeon_accel_selected && { ! __OPTIMIZE__ } } }
@@ -32,6 +34,8 @@ contains
!$acc parallel num_gangs(ng) copy(rg)
!$acc loop reduction(+:rg) gang
+ ! { dg-bogus {'rg\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'rg\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
rg = rg + array(i)
end do
@@ -39,6 +43,8 @@ contains
!$acc parallel num_workers(nw) copy(rw)
!$acc loop reduction(+:rw) worker
+ ! { dg-bogus {'rw\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'rw\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
rw = rw + array(i)
end do
@@ -46,6 +52,8 @@ contains
!$acc parallel vector_length(vl) copy(rv)
!$acc loop reduction(+:rv) vector
+ ! { dg-bogus {'rv\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'rv\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
rv = rv + array(i)
end do
@@ -53,6 +61,8 @@ contains
!$acc parallel num_gangs(ng) num_workers(nw) vector_length(vl) copy(rc)
!$acc loop reduction(+:rc) gang worker vector
+ ! { dg-bogus {'rc\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'rc\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
rc = rc + array(i)
end do
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f90 b/libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f90
index 99b1441136d..a7b7adebb09 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f90
@@ -1,5 +1,7 @@
! { dg-do run }
+! { dg-additional-options -Wuninitialized }
+
! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
! aspects of that functionality.
@@ -44,7 +46,11 @@ subroutine redsub(s1, s2, n)
integer :: s1, s2, n
!$acc parallel reduction(+:s1,s2) num_gangs (10) copy(s1)
- ! { dg-bogus "\[Ww\]arning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-1 }
+ ! { dg-bogus {'s1\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'s1\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
+ ! { dg-bogus {'s2\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-3 }
+ ! { dg-note {'s2\.[0-9]+' was declared here} {} { target *-*-* } .-4 }
+ ! { dg-bogus "\[Ww\]arning: region is gang partitioned but does not contain gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-5 }
s1 = s1 + 1
s2 = s2 + 1
!$acc end parallel
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90
index 42dc3193546..5082e367e02 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90
@@ -1,5 +1,7 @@
! { dg-do run }
-!
+
+! { dg-additional-options -Wuninitialized }
+
MODULE reduction_test
CONTAINS
@@ -16,6 +18,8 @@ SUBROUTINE reduction_kernel(x_min,x_max,y_min,y_max,arr,sum)
!$ACC DATA PRESENT(arr) COPY(sum)
!$ACC PARALLEL LOOP REDUCTION(+ : sum)
+ ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
DO k=y_min,y_max
DO j=x_min,x_max
sum=sum+arr(j,k)
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr96628-part1.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr96628-part1.f90
index 71219f9c467..06512d43c05 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/pr96628-part1.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/pr96628-part1.f90
@@ -3,6 +3,9 @@
! { dg-additional-options "-ftree-slp-vectorize" }
!
! This file is compiled first
+
+! { dg-additional-options -Wuninitialized }
+
module m2
real*8 :: mysum
!$acc declare device_resident(mysum)
@@ -16,5 +19,7 @@ contains
!$acc routine seq
REAL*8, INTENT(INOUT) :: t(:)
t = (100.0_8*t)/sum
+ ! { dg-warning {'sum' is used uninitialized} {} { target *-*-* } .-1 }
+ ! { dg-note {'sum' was declared here} {} { target *-*-* } .-2 }
END SUBROUTINE two
end module m2
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90 b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
index 3f3a1b5966b..f4a6af986e8 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90
@@ -15,6 +15,8 @@
! Prune a few: uninteresting, and varying depending on GCC configuration (data types):
! { dg-prune-output {note: variable 'D\.[0-9]+' declared in block isn't candidate for adjusting OpenACC privatization level: not addressable} }
+! { dg-additional-options -Wuninitialized }
+
! It's only with Tcl 8.5 (released in 2007) that "the variable 'varName'
! passed to 'incr' may be unset, and in that case, it will be set to [...]",
! so to maintain compatibility with earlier Tcl releases, we manually
@@ -27,10 +29,16 @@ program main
implicit none (type, external)
integer :: j
integer, allocatable :: A(:)
+ ! { dg-note {'a' declared here} {} { target *-*-* } .-1 }
character(len=:), allocatable :: my_str
character(len=15), allocatable :: my_str15
A = [(3*j, j=1, 10)]
+ ! { dg-bogus {'a\.offset' is used uninitialized} {PR77504 etc.} { xfail *-*-* } .-1 }
+ ! { dg-bogus {'a\.dim\[0\]\.lbound' is used uninitialized} {PR77504 etc.} { xfail *-*-* } .-2 }
+ ! { dg-bogus {'a\.dim\[0\]\.ubound' is used uninitialized} {PR77504 etc.} { xfail *-*-* } .-3 }
+ ! { dg-bogus {'a\.dim\[0\]\.lbound' may be used uninitialized} {PR77504 etc.} { xfail { ! __OPTIMIZE__ } } .-4 }
+ ! { dg-bogus {'a\.dim\[0\]\.ubound' may be used uninitialized} {PR77504 etc.} { xfail { ! __OPTIMIZE__ } } .-5 }
call foo (A, size(A))
call bar (A)
my_str = "1234567890"
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90 b/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90
index 5d1c1d99fce..88a691f7ca1 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90
@@ -1,5 +1,7 @@
! { dg-do run }
+! { dg-additional-options -Wuninitialized }
+
! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting
! aspects of that functionality.
@@ -36,6 +38,8 @@ subroutine redsub_gang(sum, n, c)
!$acc parallel copyin (n, c) num_gangs(n) copy(sum)
!$acc loop reduction(+:sum) gang
+ ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
sum = sum + c
end do
@@ -50,6 +54,8 @@ subroutine redsub_worker(sum, n, c)
!$acc parallel copyin (n, c) num_workers(4) vector_length (32) copy(sum)
! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-1 }
!$acc loop reduction(+:sum) worker
+ ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
sum = sum + c
end do
@@ -63,6 +69,8 @@ subroutine redsub_vector(sum, n, c)
!$acc parallel copyin (n, c) vector_length(32) copy(sum)
!$acc loop reduction(+:sum) vector
+ ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
sum = sum + c
end do
@@ -76,6 +84,8 @@ subroutine redsub_combined(sum, n, c)
!$acc parallel num_gangs (8) num_workers (4) vector_length(32) copy(sum)
!$acc loop reduction(+:sum) gang worker vector
+ ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
sum = sum + c
end do
@@ -92,8 +102,12 @@ subroutine redsub_nested(sum, n, c)
!$acc parallel num_gangs (8) copy(sum)
!$acc loop reduction(+:sum) gang
+ ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, ii
!$acc loop reduction(+:sum) vector
+ ! { dg-bogus {'sum\.[0-9]+' may be used uninitialized} TODO { xfail { ! __OPTIMIZE__ } } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target { ! __OPTIMIZE__ } } .-2 }
do j = 1, jj
sum = sum + c
end do
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/reduction-7.f90 b/libgomp/testsuite/libgomp.oacc-fortran/reduction-7.f90
index a8b0c60e420..38148f520da 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/reduction-7.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/reduction-7.f90
@@ -1,5 +1,7 @@
! { dg-do run }
+! { dg-additional-options -Wuninitialized }
+
!TODO
! { dg-xfail-run-if TODO { openacc_radeon_accel_selected && { ! __OPTIMIZE__ } } }
@@ -62,6 +64,8 @@ subroutine redsub_bogus(sum, n)
!$acc parallel firstprivate(sum)
!$acc loop gang worker vector reduction (+:sum)
+ ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do i = 1, n
sum = sum + 1
end do
@@ -80,6 +84,8 @@ subroutine redsub_combined(sum, n, arr)
sum = i;
!$acc loop reduction(+:sum)
+ ! { dg-bogus {'sum\.[0-9]+' may be used uninitialized} TODO { xfail { ! __OPTIMIZE__ } } .-1 }
+ ! { dg-note {'sum\.[0-9]+' was declared here} {} { target { ! __OPTIMIZE__ } } .-2 }
do j = 1, n
sum = sum + 1
end do
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/reference-reductions.f90 b/libgomp/testsuite/libgomp.oacc-fortran/reference-reductions.f90
index b25430e59ed..055d22510c4 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/reference-reductions.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/reference-reductions.f90
@@ -2,6 +2,8 @@
! { dg-do run }
+! { dg-additional-options -Wuninitialized }
+
module prm
implicit none
@@ -14,8 +16,12 @@ subroutine param_reduction(var)
!$acc parallel copy(var)
!$acc loop reduction(+ : var) gang
+ ! { dg-bogus {'var\.[0-9]+' is used uninitialized} TODO { xfail *-*-* } .-1 }
+ ! { dg-note {'var\.[0-9]+' was declared here} {} { target *-*-* } .-2 }
do k=1,10
!$acc loop vector reduction(+ : var)
+ ! { dg-bogus {'var\.[0-9]+' may be used uninitialized} TODO { xfail { ! __OPTIMIZE__ } } .-1 }
+ ! { dg-note {'var\.[0-9]+' was declared here} {} { target { ! __OPTIMIZE__ } } .-2 }
do j=1,100
var = var + 1.0
enddo