From: Thomas Schwinge Date: Thu, 26 Aug 2021 14:55:21 +0000 (+0200) Subject: Document current '-Wuninitialized'/'-Wmaybe-uninitialized' diagnostics for OpenACC... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4bd8b1e881f0c26a5103cd1919809b3d63b60ef2;p=test_jj.git 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. --- diff --git a/gcc/testsuite/c-c++-common/goacc/builtin-goacc-parlevel-id-size.c b/gcc/testsuite/c-c++-common/goacc/builtin-goacc-parlevel-id-size.c index 5cda818..19d6c21 100644 --- a/gcc/testsuite/c-c++-common/goacc/builtin-goacc-parlevel-id-size.c +++ b/gcc/testsuite/c-c++-common/goacc/builtin-goacc-parlevel-id-size.c @@ -1,6 +1,8 @@ /* { dg-do compile } */ /* { dg-additional-options "-O2" } */ +/* { dg-additional-options -Wuninitialized } */ + #include "../../../../include/gomp-constants.h" #pragma acc routine @@ -8,6 +10,7 @@ int foo (void) { int res; + /* { dg-note {'res' was declared here} {} { target *-*-* } .-1 } */ __builtin_goacc_parlevel_id (GOMP_DIM_GANG); __builtin_goacc_parlevel_id (GOMP_DIM_WORKER); @@ -18,6 +21,7 @@ foo (void) __builtin_goacc_parlevel_size (GOMP_DIM_VECTOR); res += __builtin_goacc_parlevel_id (GOMP_DIM_GANG); + /* { dg-warning {'res' is used uninitialized} {} { target *-*-* } .-1 } */ res += __builtin_goacc_parlevel_id (GOMP_DIM_WORKER); res += __builtin_goacc_parlevel_id (GOMP_DIM_VECTOR); @@ -34,6 +38,8 @@ foo2 (void) int res; #pragma acc parallel + /* implicit 'firstprivate (res)' + { dg-warning {'res' is used uninitialized} TODO { xfail *-*-* } .-2 } */ { __builtin_goacc_parlevel_id (GOMP_DIM_GANG); __builtin_goacc_parlevel_id (GOMP_DIM_WORKER); @@ -59,6 +65,8 @@ foo3 (void) int res; #pragma acc kernels + /* implicit 'copy (res)' + { dg-warning {'res' is used uninitialized} TODO { xfail *-*-* } .-2 } */ { __builtin_goacc_parlevel_id (GOMP_DIM_GANG); __builtin_goacc_parlevel_id (GOMP_DIM_WORKER); diff --git a/gcc/testsuite/c-c++-common/goacc/mdc-1.c b/gcc/testsuite/c-c++-common/goacc/mdc-1.c index c2b8dc6..923a4ea 100644 --- a/gcc/testsuite/c-c++-common/goacc/mdc-1.c +++ b/gcc/testsuite/c-c++-common/goacc/mdc-1.c @@ -5,6 +5,8 @@ { dg-do compile { target { lp64 || llp64 } } } */ /* { dg-additional-options "-fdump-tree-omplower" } */ +/* { dg-additional-options -Wuninitialized } */ + void t1 () { @@ -13,10 +15,12 @@ t1 () } s; int *a, *z; + /* { dg-note {'z' was declared here} {} { target *-*-* } .-1 } */ #pragma acc enter data copyin(s) { #pragma acc data copy(s.a[0:10]) copy(z[0:10]) + /* { dg-warning {'z' is used uninitialized} {} { target *-*-* } .-1 } */ { s.e = z; #pragma acc parallel loop attach(s.e) diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c index 9323e2c..e669369 100644 --- a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c +++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-kernels.c @@ -2,11 +2,16 @@ /* See also 'gfortran.dg/goacc/nested-reductions-1-kernels.f90'. */ +/* { dg-additional-options -Wuninitialized } */ + void acc_kernels (void) { int i, j, k, sum, diff; #pragma acc kernels + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ { #pragma acc loop reduction(+:sum) for (i = 0; i < 10; i++) @@ -74,6 +79,9 @@ void acc_kernels_loop (void) int i, j, k, l, sum, diff; #pragma acc kernels loop + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { #pragma acc loop reduction(+:sum) @@ -151,6 +159,9 @@ void acc_kernels_loop_reduction (void) int i, j, k, sum, diff; #pragma acc kernels loop reduction(+:sum) + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { for (i = 0; i < 10; i++) diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-parallel.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-parallel.c index ce1d0a1..1182385 100644 --- a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-parallel.c +++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-parallel.c @@ -2,11 +2,16 @@ /* See also 'gfortran.dg/goacc/nested-reductions-1-parallel.f90'. */ +/* { dg-additional-options -Wuninitialized } */ + void acc_parallel (void) { int i, j, k, sum, diff; #pragma acc parallel + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ { #pragma acc loop reduction(+:sum) for (i = 0; i < 10; i++) @@ -74,6 +79,9 @@ void acc_parallel_loop (void) int i, j, k, l, sum, diff; #pragma acc parallel loop + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { #pragma acc loop reduction(+:sum) @@ -143,6 +151,9 @@ void acc_parallel_reduction (void) int i, j, k, sum, diff; #pragma acc parallel reduction(+:sum) + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ { for (i = 0; i < 10; i++) for (j = 0; j < 10; j++) @@ -233,6 +244,9 @@ void acc_parallel_loop_reduction (void) int i, j, k, sum, diff; #pragma acc parallel loop reduction(+:sum) + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { for (i = 0; i < 10; i++) diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c index 45b8cf3..df72cd1 100644 --- a/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c +++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-1-routine.c @@ -2,6 +2,8 @@ /* See also 'gfortran.dg/goacc/nested-reductions-1-routine.f90'. */ +/* { dg-additional-options -Wuninitialized } */ + #pragma acc routine gang void acc_routine (void) { @@ -10,6 +12,7 @@ void acc_routine (void) { /* { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } */ #pragma acc loop reduction(+:sum) + /* { dg-warning {'sum' is used uninitialized} {} { target *-*-* } .-1 } */ for (i = 0; i < 10; i++) for (j = 0; j < 10; j++) for (k = 0; k < 10; k++) @@ -57,6 +60,7 @@ void acc_routine (void) /* { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } */ #pragma acc loop reduction(+:sum) reduction(-:diff) + /* { dg-warning {'diff' is used uninitialized} {} { target *-*-* } .-1 } */ for (i = 0; i < 10; i++) { #pragma acc loop reduction(+:sum) diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c index dec7dbd..16a870b 100644 --- a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c +++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-kernels.c @@ -2,11 +2,16 @@ /* See also 'gfortran.dg/goacc/nested-reductions-2-kernels.f90'. */ +/* { dg-additional-options -Wuninitialized } */ + void acc_kernels (void) { int i, j, k, l, sum, diff; #pragma acc kernels + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ { #pragma acc loop reduction(+:sum) for (i = 0; i < 10; i++) @@ -99,6 +104,9 @@ void acc_kernels_loop (void) int i, j, k, l, sum, diff; #pragma acc kernels loop + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { #pragma acc loop reduction(+:sum) @@ -209,6 +217,9 @@ void acc_kernels_loop_reduction (void) int i, j, k, l, sum, diff; #pragma acc kernels loop reduction(+:sum) + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." } diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-parallel.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-parallel.c index 1f6b4e7..840ed86 100644 --- a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-parallel.c +++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-parallel.c @@ -2,11 +2,16 @@ /* See also 'gfortran.dg/goacc/nested-reductions-2-parallel.f90'. */ +/* { dg-additional-options -Wuninitialized } */ + void acc_parallel (void) { int i, j, k, l, sum, diff; #pragma acc parallel + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ { #pragma acc loop reduction(+:sum) for (i = 0; i < 10; i++) @@ -99,6 +104,9 @@ void acc_parallel_loop (void) int i, j, k, l, sum, diff; #pragma acc parallel loop + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { #pragma acc loop reduction(+:sum) @@ -201,6 +209,9 @@ void acc_parallel_reduction (void) int i, j, k, l, sum, diff; #pragma acc parallel reduction(+:sum) + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ { #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." } for (i = 0; i < 10; i++) @@ -293,6 +304,9 @@ void acc_parallel_loop_reduction (void) int i, j, k, l, sum, diff; #pragma acc parallel loop reduction(+:sum) + /* implicit 'copy (sum, diff)' + { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } */ for (int h = 0; h < 10; ++h) { #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." } diff --git a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c index 3b2b027..dd03c85 100644 --- a/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c +++ b/gcc/testsuite/c-c++-common/goacc/nested-reductions-2-routine.c @@ -2,6 +2,8 @@ /* See also 'gfortran.dg/goacc/nested-reductions-2-routine.f90'. */ +/* { dg-additional-options -Wuninitialized } */ + #pragma acc routine gang void acc_routine (void) { @@ -10,6 +12,7 @@ void acc_routine (void) { /* { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } */ #pragma acc loop reduction(+:sum) + /* { dg-warning {'sum' is used uninitialized} {} { target *-*-* } .-1 } */ for (i = 0; i < 10; i++) #pragma acc loop // { dg-warning "nested loop in reduction needs reduction clause for .sum." } for (j = 0; j < 10; j++) @@ -83,6 +86,7 @@ void acc_routine (void) /* { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } */ #pragma acc loop reduction(+:sum) reduction(-:diff) + /* { dg-warning {'diff' is used uninitialized} {} { target *-*-* } .-1 } */ for (i = 0; i < 10; i++) { #pragma acc loop reduction(-:diff) // { dg-warning "nested loop in reduction needs reduction clause for .sum." } diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c index d9b143b..8368ccd 100644 --- a/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c +++ b/gcc/testsuite/c-c++-common/goacc/uninit-dim-clause.c @@ -6,6 +6,9 @@ void acc_parallel() { int i, j, k; + /* { dg-note {'i' was declared here} {} { target *-*-* } .-1 } */ + /* { dg-note {'j' was declared here} {} { target *-*-* } .-2 } */ + /* { dg-note {'k' was declared here} {} { target *-*-* } .-3 } */ #pragma acc parallel num_gangs(i) /* { dg-warning "is used uninitialized" } */ /* { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } */ @@ -23,6 +26,9 @@ void acc_parallel() void acc_kernels() { int i, j, k; + /* { dg-note {'i' was declared here} {} { target *-*-* } .-1 } */ + /* { dg-note {'j' was declared here} {} { target *-*-* } .-2 } */ + /* { dg-note {'k' was declared here} {} { target *-*-* } .-3 } */ #pragma acc kernels num_gangs(i) /* { dg-warning "is used uninitialized" } */ ; diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-firstprivate-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-firstprivate-clause.c index 334567d..bfe1a11 100644 --- a/gcc/testsuite/c-c++-common/goacc/uninit-firstprivate-clause.c +++ b/gcc/testsuite/c-c++-common/goacc/uninit-firstprivate-clause.c @@ -17,6 +17,7 @@ void foo2 (void) { int i; + /* { dg-note {'i' was declared here} {} { target *-*-* } .-1 } */ #pragma acc parallel firstprivate (i) /* { dg-warning "is used uninitialized" } */ { diff --git a/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c b/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c index 683ac1b..de410e5 100644 --- a/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c +++ b/gcc/testsuite/c-c++-common/goacc/uninit-if-clause.c @@ -7,7 +7,15 @@ int main (void) { int l, l2, l3, l4; + /* { dg-note {'l' was declared here} {} { target *-*-* } .-1 } */ + /* { dg-note {'l2' was declared here} {} { target *-*-* } .-2 } */ + /* { dg-note {'l3' was declared here} {} { target *-*-* } .-3 } */ + /* { dg-note {'l4' was declared here} {} { target *-*-* } .-4 } */ bool b, b2, b3, b4; + /* { dg-note {'b' was declared here} {} { target *-*-* } .-1 } */ + /* { dg-note {'b2' was declared here} {} { target *-*-* } .-2 } */ + /* { dg-note {'b3' was declared here} {} { target *-*-* } .-3 } */ + /* { dg-note {'b4' was declared here} {} { target *-*-* } .-4 } */ int i, i2; #pragma acc parallel if(l) /* { dg-warning "is used uninitialized" } */ diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-1.f90 b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-1.f90 index 4a3ff0e..136e42a 100644 --- a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-1.f90 @@ -1,10 +1,15 @@ +! { dg-additional-options -Wuninitialized } + type t integer, allocatable :: A(:,:) end type t type(t), allocatable :: b(:) +! { dg-note {'b' declared here} {} { target *-*-* } .-1 } !$acc update host(b) +! { dg-warning {'b\.dim\[0\]\.ubound' is used uninitialized} {} { target *-*-* } .-1 } +! { dg-warning {'b\.dim\[0\]\.lbound' is used uninitialized} {} { target *-*-* } .-2 } !$acc update host(b(:)) !$acc update host(b(1)%A) !$acc update host(b(1)%A(:,:)) diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 index 807580d..58f4ce8 100644 --- a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-2.f90 @@ -1,10 +1,15 @@ +! { dg-additional-options -Wuninitialized } + type t integer, allocatable :: A(:,:) end type t type(t), allocatable :: b(:) +! { dg-note {'b' declared here} {} { target *-*-* } .-1 } !$acc update host(b(::2)) +! { dg-warning {'b\.dim\[0\]\.ubound' is used uninitialized} {} { target *-*-* } .-1 } +! { dg-warning {'b\.dim\[0\]\.lbound' is used uninitialized} {} { target *-*-* } .-2 } !$acc update host(b(1)%A(::3,::4)) end diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-3.f90 b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-3.f90 index dcb6365..d1fa010 100644 --- a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-3.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-3.f90 @@ -1,3 +1,5 @@ +! { dg-additional-options -Wuninitialized } + type t2 integer :: A(200,200) end type t2 @@ -6,9 +8,15 @@ type t end type t type(t2),allocatable :: c(:) +! { dg-note {'c' declared here} {} { target *-*-* } .-1 } +! { dg-note {'c\.offset' was declared here} {} { target *-*-* } .-2 } type(t), allocatable :: d(:) +! { dg-note {'d' declared here} {} { target *-*-* } .-1 } +! { dg-note {'d\.offset' was declared here} {} { target *-*-* } .-2 } !$acc exit data delete(c(1)%A) +! { dg-warning {'c\.offset' is used uninitialized} {} { target *-*-* } .-1 } !$acc exit data delete(d(1)%A) +! { dg-warning {'d\.offset' is used uninitialized} {} { target *-*-* } .-1 } end diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90 b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90 index 637d5f5..ac00535 100644 --- a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-4.f90 @@ -1,3 +1,5 @@ +! { dg-additional-options -Wuninitialized } + type t4 integer, allocatable :: quux(:) end type t4 @@ -12,7 +14,10 @@ type t end type t type(t), allocatable :: c(:) +! { dg-note {'c' declared here} {} { target *-*-* } .-1 } !$acc enter data copyin(c(5)%foo(4)%bar(3)%qux(2)%quux(:)) +! { dg-warning {'c\.offset' is used uninitialized} {} { target *-*-* } .-1 } !$acc exit data delete(c(5)%foo(4)%bar(3)%qux(2)%quux(:)) +! { dg-warning {'c\.offset' is used uninitialized} {} { target *-*-* } .-1 } end diff --git a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-5.f90 b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-5.f90 index 900587b..ba60ca7 100644 --- a/gcc/testsuite/gfortran.dg/goacc/array-with-dt-5.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/array-with-dt-5.f90 @@ -1,3 +1,5 @@ +! { dg-additional-options -Wuninitialized } + type t2 integer :: bar end type t2 @@ -6,7 +8,9 @@ type t end type t type(t) :: c +! { dg-note {'c' declared here} {} { target *-*-* } .-1 } !$acc enter data copyin(c%foo) +! { dg-warning {'c\.foo' is used uninitialized} {} { target *-*-* } .-1 } end diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 index e4d360e..ac45856 100644 --- a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-1.f90 @@ -1,3 +1,5 @@ +! { dg-additional-options -Wuninitialized } + type :: type1 character(len=35) :: a end type type1 diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 index cca6443..f4f791d 100644 --- a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-2.f90 @@ -1,3 +1,5 @@ +! { dg-additional-options -Wuninitialized } + type :: type1 character(len=35,kind=4) :: a end type type1 diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 index 2bab497..a523d4f 100644 --- a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-3.f90 @@ -1,5 +1,7 @@ ! { dg-additional-options "-fdump-tree-gimple" } +! { dg-additional-options -Wuninitialized } + type :: type1 character(len=35) :: a end type type1 @@ -12,10 +14,16 @@ type(type1) :: foo type(type2) :: bar type(type1), pointer :: pfoo +! { dg-note {'pfoo' was declared here} {} { target *-*-* } .-1 } type(type2), pointer :: pbar +! { dg-note {'pbar' was declared here} {} { target *-*-* } .-1 } class(type1), pointer :: cfoo +! { dg-note {'cfoo' declared here} {} { target *-*-* } .-1 } +! { dg-note {'cfoo\._data' was declared here} {} { target *-*-* } .-2 } class(type2), pointer :: cbar +! { dg-note {'cbar' declared here} {} { target *-*-* } .-1 } +! { dg-note {'cbar\._data' was declared here} {} { target *-*-* } .-2 } class(type1), allocatable :: acfoo class(type2), allocatable :: acbar @@ -24,10 +32,14 @@ class(type2), allocatable :: acbar !$acc enter data copyin(bar%b) !$acc enter data copyin(pfoo%a) +! { dg-warning {'pfoo' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(pbar%b) +! { dg-warning {'pbar' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(cfoo%a) +! { dg-warning {'cfoo\._data' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(cbar%b) +! { dg-warning {'cbar\._data' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(acfoo%a) !$acc enter data copyin(acbar%b) diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 index cfe4006..a95e3fa 100644 --- a/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/derived-chartypes-4.f90 @@ -1,5 +1,7 @@ ! { dg-additional-options "-fdump-tree-gimple" } +! { dg-additional-options -Wuninitialized } + type :: type1 character(len=35,kind=4) :: a end type type1 @@ -12,10 +14,16 @@ type(type1) :: foo type(type2) :: bar type(type1), pointer :: pfoo +! { dg-note {'pfoo' was declared here} {} { target *-*-* } .-1 } type(type2), pointer :: pbar +! { dg-note {'pbar' was declared here} {} { target *-*-* } .-1 } class(type1), pointer :: cfoo +! { dg-note {'cfoo' declared here} {} { target *-*-* } .-1 } +! { dg-note {'cfoo\._data' was declared here} {} { target *-*-* } .-2 } class(type2), pointer :: cbar +! { dg-note {'cbar' declared here} {} { target *-*-* } .-1 } +! { dg-note {'cbar\._data' was declared here} {} { target *-*-* } .-2 } class(type1), allocatable :: acfoo class(type2), allocatable :: acbar @@ -24,10 +32,14 @@ class(type2), allocatable :: acbar !$acc enter data copyin(bar%b) !$acc enter data copyin(pfoo%a) +! { dg-warning {'pfoo' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(pbar%b) +! { dg-warning {'pbar' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(cfoo%a) +! { dg-warning {'cfoo\._data' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(cbar%b) +! { dg-warning {'cbar\._data' is used uninitialized} {} { target *-*-* } .-1 } !$acc enter data copyin(acfoo%a) !$acc enter data copyin(acbar%b) diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95 b/gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95 index 85a2e1d..6d88039 100644 --- a/gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/derived-classtypes-1.f95 @@ -1,3 +1,5 @@ +! { dg-additional-options -Wuninitialized } + type :: type1 integer :: a end type type1 diff --git a/gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90 b/gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90 index d01583f..505e0b4 100644 --- a/gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/derived-types-2.f90 @@ -1,3 +1,5 @@ +! { dg-additional-options -Wuninitialized } + module bar type :: type1 real(8), pointer, public :: p(:) => null() diff --git a/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95 index e575890..9517ce4 100644 --- a/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/host_data-tree.f95 @@ -1,10 +1,14 @@ ! { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } +! { dg-additional-options -Wuninitialized } + program test implicit none integer, pointer :: p + ! { dg-note {'p' was declared here} {} { target *-*-* } .-1 } !$acc host_data use_device(p) + ! { dg-warning {'p' is used uninitialized} {} { target *-*-* } .-1 } ! { dg-final { scan-tree-dump-times "(?n)#pragma acc host_data use_device_ptr\\(p\\)$" 1 "original" } } ! { dg-final { scan-tree-dump-times "(?n)#pragma omp target oacc_host_data use_device_ptr\\(p\\)$" 1 "gimple" } } !$acc end host_data diff --git a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 index 688ed0a..ceb07fb 100644 --- a/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/kernels-tree.f95 @@ -3,9 +3,12 @@ ! { dg-additional-options "--param=openacc-kernels=decompose" } ! { dg-additional-options "-fdump-tree-omp_oacc_kernels_decompose" } +! { dg-additional-options -Wuninitialized } + program test implicit none integer :: q, i, j, k, m, n, o, p, r, s, t, u, v, w + ! { dg-note {'i' was declared here} {} { target *-*-* } .-1 } logical :: l = .true. !$acc kernels if(l) async num_gangs(i) num_workers(i) vector_length(i) & @@ -13,6 +16,7 @@ program test !$acc no_create(n) & !$acc present(o), pcopy(p), pcopyin(r), pcopyout(s), pcreate(t) & !$acc deviceptr(u) + ! { dg-warning {'i' is used uninitialized} {} { target *-*-* } .-1 } !$acc end kernels end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/modules.f95 b/gcc/testsuite/gfortran.dg/goacc/modules.f95 index 19a2abe..1e8d826 100644 --- a/gcc/testsuite/gfortran.dg/goacc/modules.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/modules.f95 @@ -1,4 +1,4 @@ -! { dg-do compile } +! { dg-additional-options -Wuninitialized } MODULE reduction_test @@ -18,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/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90 index 60cb630..73812fe 100644 --- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-kernels.f90 @@ -2,11 +2,16 @@ ! See also 'c-c++-common/goacc/nested-reductions-1-kernels.c'. +! { dg-additional-options -Wuninitialized } + subroutine acc_kernels () implicit none (type, external) integer :: i, j, k, sum, diff !$acc kernels + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } !$acc loop reduction(+:sum) do i = 1, 10 do j = 1, 10 @@ -94,6 +99,9 @@ subroutine acc_kernels_loop () integer :: h, i, j, k, l, sum, diff !$acc kernels loop + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 !$acc loop reduction(+:sum) do i = 1, 10 @@ -192,6 +200,9 @@ subroutine acc_kernels_loop_reduction () integer :: h, i, j, k, sum, diff !$acc kernels loop reduction(+:sum) + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 do i = 1, 10 do j = 1, 10 diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-parallel.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-parallel.f90 index 2915d67..9494f34 100644 --- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-parallel.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-parallel.f90 @@ -2,11 +2,16 @@ ! See also 'c-c++-common/goacc/nested-reductions-1-parallel.c'. +! { dg-additional-options -Wuninitialized } + subroutine acc_parallel () implicit none (type, external) integer :: i, j, k, sum, diff !$acc parallel + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } !$acc loop reduction(+:sum) do i = 1, 10 do j = 1, 10 @@ -94,6 +99,9 @@ subroutine acc_parallel_loop () integer :: h, i, j, k, l, sum, diff !$acc parallel loop + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 !$acc loop reduction(+:sum) do i = 1, 10 @@ -183,6 +191,9 @@ subroutine acc_parallel_reduction () integer :: i, j, k, sum, diff !$acc parallel reduction(+:sum) + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do i = 1, 10 do j = 1, 10 do k = 1, 10 @@ -296,6 +307,9 @@ subroutine acc_parallel_loop_reduction () integer :: h, i, j, k, sum, diff !$acc parallel loop reduction(+:sum) + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 do i = 1, 10 do j = 1, 10 diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90 index e1b0a02..f89e9fe 100644 --- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-1-routine.f90 @@ -2,6 +2,8 @@ ! See also 'c-c++-common/goacc/nested-reductions-1-routine.c'. +! { dg-additional-options -Wuninitialized } + subroutine acc_routine () implicit none (type, external) !$acc routine gang @@ -10,6 +12,7 @@ subroutine acc_routine () ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } !$acc loop reduction(+:sum) + ! { dg-warning {'sum' is used uninitialized} {} { target *-*-* } .-1 } do i = 1, 10 do j = 1, 10 do k = 1, 10 @@ -75,6 +78,7 @@ subroutine acc_routine () ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } !$acc loop reduction(+:sum) reduction(-:diff) + ! { dg-warning {'diff' is used uninitialized} {} { target *-*-* } .-1 } do i = 1, 10 !$acc loop reduction(+:sum) do j = 1, 10 diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90 index 6ee41843..8b143e9 100644 --- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-kernels.f90 @@ -2,11 +2,16 @@ ! See also 'c-c++-common/goacc/nested-reductions-2-kernels.c'. +! { dg-additional-options -Wuninitialized } + subroutine acc_kernels () implicit none (type, external) integer :: i, j, k, l, sum, diff !$acc kernels + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } !$acc loop reduction(+:sum) do i = 1, 10 !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } @@ -126,6 +131,9 @@ subroutine acc_kernels_loop () integer :: h, i, j, k, l, sum, diff !$acc kernels loop + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 !$acc loop reduction(+:sum) do i = 1, 10 @@ -266,6 +274,9 @@ subroutine acc_kernels_loop_reduction () integer :: h, i, j, k, l, sum, diff !$acc kernels loop reduction(+:sum) + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } do i = 1, 10 diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-parallel.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-parallel.f90 index 8fa2cab..99cd22c 100644 --- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-parallel.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-parallel.f90 @@ -2,11 +2,16 @@ ! See also 'c-c++-common/goacc/nested-reductions-2-parallel.c'. +! { dg-additional-options -Wuninitialized } + subroutine acc_parallel () implicit none (type, external) integer :: i, j, k, l, sum, diff !$acc parallel + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } !$acc loop reduction(+:sum) do i = 1, 10 !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } @@ -126,6 +131,9 @@ subroutine acc_parallel_loop () integer :: h, i, j, k, l, sum, diff !$acc parallel loop + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 !$acc loop reduction(+:sum) do i = 1, 10 @@ -257,6 +265,9 @@ subroutine acc_parallel_reduction () integer :: i, j, k, l, sum, diff !$acc parallel reduction(+:sum) + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } do i = 1, 10 !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } @@ -376,6 +387,9 @@ subroutine acc_parallel_loop_reduction () integer :: h, i, j, k, l, sum, diff !$acc parallel loop reduction(+:sum) + ! implicit 'copy (sum, diff)' + ! { dg-warning {'sum' is used uninitialized} TODO { xfail *-*-* } .-2 } + ! { dg-warning {'diff' is used uninitialized} TODO { xfail *-*-* } .-3 } do h = 1, 10 !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } do i = 1, 10 diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90 index 73a0520..d60ec58 100644 --- a/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/nested-reductions-2-routine.f90 @@ -2,6 +2,8 @@ ! See also 'c-c++-common/goacc/nested-reductions-2-routine.c'. +! { dg-additional-options -Wuninitialized } + subroutine acc_routine () implicit none (type, external) !$acc routine gang @@ -9,6 +11,7 @@ subroutine acc_routine () ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } !$acc loop reduction(+:sum) + ! { dg-warning {'sum' is used uninitialized} {} { target *-*-* } .-1 } do i = 1, 10 !$acc loop ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } do j = 1, 10 @@ -107,6 +110,7 @@ subroutine acc_routine () ! { dg-error "gang reduction on an orphan loop" "" { target *-*-* } .+1 } !$acc loop reduction(+:sum) reduction(-:diff) + ! { dg-warning {'diff' is used uninitialized} {} { target *-*-* } .-1 } do i = 1, 10 !$acc loop reduction(-:diff) ! { dg-warning "nested loop in reduction needs reduction clause for .sum." } do j = 1, 10 diff --git a/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 b/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 index c51cb2a..6110d93 100644 --- a/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/parallel-tree.f95 @@ -2,12 +2,15 @@ ! test for tree-dump-original and spaces-commas +! { dg-additional-options -Wuninitialized } + ! { dg-additional-options "-Wopenacc-parallelism" } for testing/documenting ! aspects of that functionality. program test implicit none integer :: q, i, j, k, m, n, o, p, r, s, t, u, v, w + ! { dg-note {'i' was declared here} {} { target *-*-* } .-1 } logical :: l = .true. !$acc parallel if(l) async num_gangs(i) num_workers(i) vector_length(i) & @@ -15,9 +18,10 @@ program test !$acc no_create(n) & !$acc present(o), pcopy(p), pcopyin(r), pcopyout(s), pcreate(t) & !$acc deviceptr(u), private(v), firstprivate(w) - ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } - ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-2 } - ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-3 } + ! { dg-warning {'i' is used uninitialized} {} { target *-*-* } .-1 } + ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-2 } + ! { dg-warning "region is worker partitioned but does not contain worker partitioned code" "" { target *-*-* } .-3 } + ! { dg-warning "region is vector partitioned but does not contain vector partitioned code" "" { target *-*-* } .-4 } !$acc end parallel end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/pr93464.f90 b/gcc/testsuite/gfortran.dg/goacc/pr93464.f90 index 9221065..c92f1d3 100644 --- a/gcc/testsuite/gfortran.dg/goacc/pr93464.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/pr93464.f90 @@ -1,13 +1,16 @@ -! { dg-do compile } -! ! PR fortran/93464 ! ! Contributed by G. Steinmetz -! + +! { dg-additional-options -Wuninitialized } + program p character :: c(2) = 'a' character, allocatable :: z(:) + ! { dg-note {'z' declared here} {} { target *-*-* } .-1 } !$acc parallel + ! { dg-warning {'z\.dim\[0\]\.ubound' is used uninitialized} {} { target *-*-* } .-1 } + ! { dg-warning {'z\.dim\[0\]\.lbound' is used uninitialized} {} { target *-*-* } .-2 } !$omp target z = c !$acc end parallel diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 index 47ba5ba..c825a95 100644 --- a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90 @@ -4,6 +4,8 @@ ! { dg-additional-options "--param=openacc-privatization=noisy" } for ! testing/documenting aspects of that functionality. +! { dg-additional-options -Wuninitialized } + ! See also '../../c-c++-common/goacc/privatization-1-compute-loop.c'. !TODO More cases should be added here. @@ -38,6 +40,7 @@ contains ! (See C/C++ example.) a = g (i, j, a, c) + ! { dg-warning {'a' is used uninitialized} TODO { xfail *-*-* } .-1 } x = a !$acc atomic write y = a diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 index 4813e44..a88203e 100644 --- a/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-compute.f90 @@ -4,6 +4,8 @@ ! { dg-additional-options "--param=openacc-privatization=noisy" } for ! testing/documenting aspects of that functionality. +! { dg-additional-options -Wuninitialized } + ! See also '../../c-c++-common/goacc/privatization-1-compute.c'. !TODO More cases should be added here. @@ -11,13 +13,13 @@ ! 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 ! initialize counter variables: -! { dg-line l_dummy[variable c_compute 0] } +! { dg-line l_dummy[variable c_compute 0 c_function 0] } ! { dg-message "dummy" "" { target iN-VAl-Id } l_dummy } to avoid ! "WARNING: dg-line var l_dummy defined, but not used". module m contains - subroutine f (i, j, a) + subroutine f (i, j, a) ! { dg-line l_function[incr c_function] } implicit none integer :: i, j, a integer :: x, y @@ -35,6 +37,12 @@ contains ! (See C/C++ example.) a = g (i, j, a, c) + ! { dg-warning {'i' is used uninitialized} {} { target *-*-* } .-1 } + ! { dg-note {'i' was declared here} {} { target *-*-* } l_function$c_function } + ! { dg-warning {'j' is used uninitialized} {} { target *-*-* } .-3 } + ! { dg-note {'j' was declared here} {} { target *-*-* } l_function$c_function } + ! { dg-warning {'a' is used uninitialized} {} { target *-*-* } .-5 } + ! { dg-note {'a' was declared here} {} { target *-*-* } l_function$c_function } x = a !$acc atomic write ! ... to force 'TREE_ADDRESSABLE'. y = a diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 index 36f2a88..74c740f 100644 --- a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang-loop.f90 @@ -4,6 +4,8 @@ ! { dg-additional-options "--param=openacc-privatization=noisy" } for ! testing/documenting aspects of that functionality. +! { dg-additional-options -Wuninitialized } + ! See also '../../c-c++-common/goacc/privatization-1-routine_gang-loop.c'. !TODO More cases should be added here. @@ -38,6 +40,7 @@ contains ! (See C/C++ example.) a = g (i, j, a, c) + ! { dg-warning {'a' is used uninitialized} TODO { xfail *-*-* } .-1 } x = a !$acc atomic write y = a diff --git a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 index 0615a44..59bd43e 100644 --- a/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/privatization-1-routine_gang.f90 @@ -4,6 +4,8 @@ ! { dg-additional-options "--param=openacc-privatization=noisy" } for ! testing/documenting aspects of that functionality. +! { dg-additional-options -Wuninitialized } + ! See also '../../c-c++-common/goacc/privatization-1-routine_gang.c'. !TODO More cases should be added here. diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 index 59e923f..1045439 100644 --- a/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/uninit-dim-clause.f95 @@ -6,6 +6,9 @@ subroutine acc_parallel implicit none integer :: i, j, k + ! { dg-note {'i' was declared here} {} { target *-*-* } .-1 } + ! { dg-note {'j' was declared here} {} { target *-*-* } .-2 } + ! { dg-note {'k' was declared here} {} { target *-*-* } .-3 } !$acc parallel num_gangs(i) ! { dg-warning "is used uninitialized" } ! { dg-warning "region is gang partitioned but does not contain gang partitioned code" "" { target *-*-* } .-1 } @@ -23,6 +26,9 @@ end subroutine acc_parallel subroutine acc_kernels implicit none integer :: i, j, k + ! { dg-note {'i' was declared here} {} { target *-*-* } .-1 } + ! { dg-note {'j' was declared here} {} { target *-*-* } .-2 } + ! { dg-note {'k' was declared here} {} { target *-*-* } .-3 } !$acc kernels num_gangs(i) ! { dg-warning "is used uninitialized" } !$acc end kernels diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-firstprivate-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-firstprivate-clause.f95 index cd5d189..9615fee 100644 --- a/gcc/testsuite/gfortran.dg/goacc/uninit-firstprivate-clause.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/uninit-firstprivate-clause.f95 @@ -11,6 +11,7 @@ end subroutine test subroutine test2 INTEGER :: i + ! { dg-note {'i' was declared here} {} { target *-*-* } .-1 } !$acc parallel firstprivate (i) ! { dg-warning "is used uninitialized" } i = 1 diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-if-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-if-clause.f95 index 73eb4ee..a059bd9 100644 --- a/gcc/testsuite/gfortran.dg/goacc/uninit-if-clause.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/uninit-if-clause.f95 @@ -4,6 +4,10 @@ program test implicit none logical :: b, b2, b3, b4 + ! { dg-note {'b' was declared here} {} { target *-*-* } .-1 } + ! { dg-note {'b2' was declared here} {} { target *-*-* } .-2 } + ! { dg-note {'b3' was declared here} {} { target *-*-* } .-3 } + ! { dg-note {'b4' was declared here} {} { target *-*-* } .-4 } integer :: data, data2 !$acc parallel if(b) ! { dg-warning "is used uninitialized" } diff --git a/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95 b/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95 index 35310d1..f661f51 100644 --- a/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95 +++ b/gcc/testsuite/gfortran.dg/goacc/uninit-use-device-clause.f95 @@ -3,6 +3,7 @@ subroutine test integer, pointer :: p + ! { dg-note {'p' was declared here} {} { target *-*-* } .-1 } !$acc host_data use_device(p) ! { dg-warning "is used uninitialized" } !$acc end host_data diff --git a/gcc/testsuite/gfortran.dg/goacc/wait.f90 b/gcc/testsuite/gfortran.dg/goacc/wait.f90 index 9cdbcdf..60018bc 100644 --- a/gcc/testsuite/gfortran.dg/goacc/wait.f90 +++ b/gcc/testsuite/gfortran.dg/goacc/wait.f90 @@ -1,12 +1,16 @@ ! Ensure that ACC WAIT accept integer arguments. +! { dg-additional-options -Wuninitialized } + subroutine foo (wqueue) implicit none integer :: wqueue, waitno + ! { dg-note {'waitno' was declared here} {} { target *-*-* } .-1 } integer, parameter :: waitp = 100 !$acc wait (wqueue) !$acc wait (waitno) + ! { dg-warning {'waitno' is used uninitialized} {} { target *-*-* } .-1 } !$acc wait (waitp) !$acc wait (0) end subroutine foo 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 86171d4..489f26a 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 #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 c68a279..37c8457 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 5fa9364..bc419cf 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 9e8915f..562cb6a 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 69b69b6..0bb05b9 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 99b1441..a7b7ade 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 42dc319..5082e36 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 71219f9..06512d4 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 3f3a1b5..f4a6af9 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 5d1c1d9..88a691f 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 a8b0c60..38148f5 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 b25430e..055d225 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