From: Thomas Schwinge Date: Wed, 17 Apr 2019 08:34:20 +0000 (+0200) Subject: [PR90048] Fortran OpenACC 'private' clause rejected for predetermined private loop... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=b39c686b82ddfa60efe55d437121e0029644e509;p=gcc.git [PR90048] Fortran OpenACC 'private' clause rejected for predetermined private loop iteration variable gcc/fortran/ PR fortran/90048 * openmp.c (gfc_resolve_do_iterator): Handle sharing_clauses for OpenACC, too. (gfc_resolve_oacc_blocks): Populate sharing_clauses with private clauses. gcc/testsuite/ PR fortran/90048 * gfortran.dg/goacc/private-explicit-kernels-1.f95: New file. * gfortran.dg/goacc/private-explicit-parallel-1.f95: Likewise. * gfortran.dg/goacc/private-explicit-routine-1.f95: Likewise. From-SVN: r270406 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e27743cac28..1ff03e1e85b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,11 @@ +2019-04-17 Thomas Schwinge + + PR fortran/90048 + * openmp.c (gfc_resolve_do_iterator): Handle sharing_clauses for + OpenACC, too. + (gfc_resolve_oacc_blocks): Populate sharing_clauses with private + clauses. + 2019-04-14 Paul Thomas PR fortran/89843 diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 9fc236760a1..1c7bce6c300 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -5510,8 +5510,7 @@ gfc_resolve_do_iterator (gfc_code *code, gfc_symbol *sym, bool add_clause) if (!omp_current_ctx->is_openmp && !oacc_is_loop (omp_current_ctx->code)) return; - if (omp_current_ctx->is_openmp - && omp_current_ctx->sharing_clauses->contains (sym)) + if (omp_current_ctx->sharing_clauses->contains (sym)) return; if (! omp_current_ctx->private_iterators->add (sym) && add_clause) @@ -5971,19 +5970,34 @@ void gfc_resolve_oacc_blocks (gfc_code *code, gfc_namespace *ns) { fortran_omp_context ctx; + gfc_omp_clauses *omp_clauses = code->ext.omp_clauses; + gfc_omp_namelist *n; + int list; resolve_oacc_loop_blocks (code); ctx.code = code; - ctx.sharing_clauses = NULL; + ctx.sharing_clauses = new hash_set; ctx.private_iterators = new hash_set; ctx.previous = omp_current_ctx; ctx.is_openmp = false; omp_current_ctx = &ctx; + for (list = 0; list < OMP_LIST_NUM; list++) + switch (list) + { + case OMP_LIST_PRIVATE: + for (n = omp_clauses->lists[list]; n; n = n->next) + ctx.sharing_clauses->add (n->sym); + break; + default: + break; + } + gfc_resolve_blocks (code->block, ns); omp_current_ctx = ctx.previous; + delete ctx.sharing_clauses; delete ctx.private_iterators; } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0ed8b3c5283..937057421e4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2019-04-17 Thomas Schwinge + PR fortran/90048 + * gfortran.dg/goacc/private-explicit-kernels-1.f95: New file. + * gfortran.dg/goacc/private-explicit-parallel-1.f95: Likewise. + * gfortran.dg/goacc/private-explicit-routine-1.f95: Likewise. + PR fortran/90067 PR fortran/90114 * gfortran.dg/goacc/private-1.f95: Remove file. diff --git a/gcc/testsuite/gfortran.dg/goacc/private-explicit-kernels-1.f95 b/gcc/testsuite/gfortran.dg/goacc/private-explicit-kernels-1.f95 new file mode 100644 index 00000000000..5d563d226b0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/private-explicit-kernels-1.f95 @@ -0,0 +1,248 @@ +! Explicit 'private' clauses related to 'do' loops inside an OpenACC +! 'kernels' construct. + +! { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } + +! (The 'independent' clauses are used as end of directive markers in tree dump +! scanning.) + +program test + implicit none + integer :: i0_1 + integer :: i0_2, j0_2 + integer :: i1_s + integer :: i1_c + integer :: i2_1_s, j2_1_s + integer :: i2_1_c, j2_1_c + integer :: i2_2_s, j2_2_s + integer :: i2_3_s, j2_3_s + integer :: i2_3_c, j2_3_c + integer :: i3_1_s, j3_1_s, k3_1_s + integer :: i3_1_c, j3_1_c, k3_1_c + integer :: i3_2_s, j3_2_s, k3_2_s + integer :: i3_2_c, j3_2_c, k3_2_c + integer :: i3_3_s, j3_3_s, k3_3_s + integer :: i3_3_c, j3_3_c, k3_3_c + integer :: i3_4_s, j3_4_s, k3_4_s + integer :: i3_4_c, j3_4_c, k3_4_c + integer :: i3_5_s, j3_5_s, k3_5_s + + !$acc kernels ! Explicit "private(i0_1)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i0_1\\)" 1 "original" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "private\\(i0_1\\)" 1 "gimple" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_kernels map\\(force_tofrom:i0_1 \\\[len: \[0-9\]+\\\]\\)" 0 "gimple" { xfail *-*-* } } } ! PR90067 + do i0_1 = 1, 100 + end do + !$acc end kernels + + !$acc kernels ! Explicit "private(i0_2, j0_2)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i0_2\\)" 1 "original" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "private\\(j0_2\\)" 1 "original" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "private\\(i0_2\\)" 1 "gimple" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "private\\(j0_2\\)" 1 "gimple" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_kernels map\\(force_tofrom:j0_2 \\\[len: \[0-9\]+\\\]\\) map\\(force_tofrom:i0_2 \\\[len: \[0-9\]+\\\]\\)" 0 "gimple" { xfail *-*-* } } } ! PR90067 + do i0_2 = 1, 100 + do j0_2 = 1, 100 + end do + end do + !$acc end kernels + + !$acc kernels + !$acc loop private(i1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_s\\) independent" 1 "gimple" } } + do i1_s = 1, 100 + end do + !$acc end kernels + + !$acc kernels loop private(i1_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_c\\) independent" 1 "gimple" } } + do i1_c = 1, 100 + end do + + !$acc kernels + !$acc loop private(i2_1_s, j2_1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_s\\) private\\(j2_1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_s\\) private\\(j2_1_s\\) independent" 1 "gimple" } } + do i2_1_s = 1, 100 + do j2_1_s = 1, 100 + end do + end do + !$acc end kernels + + !$acc kernels loop private(i2_1_c, j2_1_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_c\\) private\\(j2_1_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_c\\) private\\(j2_1_c\\) independent" 1 "gimple" } } + do i2_1_c = 1, 100 + do j2_1_c = 1, 100 + end do + end do + + !$acc kernels ! Explicit "private(i2_2_s)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i2_2_s\\)" 1 "original" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "private\\(i2_2_s\\)" 1 "gimple" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_kernels map\\(force_tofrom:i2_2_s \\\[len: \[0-9\]+\\\]\\)" 0 "gimple" { xfail *-*-* } } } ! PR90067 + do i2_2_s = 1, 100 + !$acc loop private(j2_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_2_s\\) independent" 1 "gimple" } } + do j2_2_s = 1, 100 + end do + end do + !$acc end kernels + + !$acc kernels + !$acc loop private(i2_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_s\\) independent" 1 "gimple" } } + do i2_3_s = 1, 100 + !$acc loop private(j2_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_s\\) independent" 1 "gimple" } } + do j2_3_s = 1, 100 + end do + end do + !$acc end kernels + + !$acc kernels loop private(i2_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_c\\) independent" 1 "gimple" } } + do i2_3_c = 1, 100 + !$acc loop private(j2_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_c\\) independent" 1 "gimple" } } + do j2_3_c = 1, 100 + end do + end do + + !$acc kernels + !$acc loop private(i3_1_s, j3_1_s, k3_1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_s\\) private\\(j3_1_s\\) private\\(k3_1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_s\\) private\\(j3_1_s\\) private\\(k3_1_s\\) independent" 1 "gimple" } } + do i3_1_s = 1, 100 + do j3_1_s = 1, 100 + do k3_1_s = 1, 100 + end do + end do + end do + !$acc end kernels + + !$acc kernels loop private(i3_1_c, j3_1_c, k3_1_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_c\\) private\\(j3_1_c\\) private\\(k3_1_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_c\\) private\\(j3_1_c\\) private\\(k3_1_c\\) independent" 1 "gimple" } } + do i3_1_c = 1, 100 + do j3_1_c = 1, 100 + do k3_1_c = 1, 100 + end do + end do + end do + + !$acc kernels + !$acc loop private(i3_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_s\\) independent" 1 "gimple" } } + do i3_2_s = 1, 100 + !$acc loop private(j3_2_s, k3_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_s\\) private\\(k3_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_s\\) private\\(k3_2_s\\) independent" 1 "gimple" } } + do j3_2_s = 1, 100 + do k3_2_s = 1, 100 + end do + end do + end do + !$acc end kernels + + !$acc kernels loop private(i3_2_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_c\\) independent" 1 "gimple" } } + do i3_2_c = 1, 100 + !$acc loop private(j3_2_c, k3_2_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_c\\) private\\(k3_2_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_c\\) private\\(k3_2_c\\) independent" 1 "gimple" } } + do j3_2_c = 1, 100 + do k3_2_c = 1, 100 + end do + end do + end do + + !$acc kernels + !$acc loop private(i3_3_s, j3_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_s\\) private\\(j3_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_s\\) private\\(j3_3_s\\) independent" 1 "gimple" } } + do i3_3_s = 1, 100 + do j3_3_s = 1, 100 + !$acc loop private(k3_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_s\\) independent" 1 "gimple" } } + do k3_3_s = 1, 100 + end do + end do + end do + !$acc end kernels + + !$acc kernels loop private(i3_3_c, j3_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_c\\) private\\(j3_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_c\\) private\\(j3_3_c\\) independent" 1 "gimple" } } + do i3_3_c = 1, 100 + do j3_3_c = 1, 100 + !$acc loop private(k3_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_c\\) independent" 1 "gimple" } } + do k3_3_c = 1, 100 + end do + end do + end do + + !$acc kernels + !$acc loop private(i3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_s\\) independent" 1 "gimple" } } + do i3_4_s = 1, 100 + !$acc loop private(j3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_s\\) independent" 1 "gimple" } } + do j3_4_s = 1, 100 + !$acc loop private(k3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_s\\) independent" 1 "gimple" } } + do k3_4_s = 1, 100 + end do + end do + end do + !$acc end kernels + + !$acc kernels loop private(i3_4_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_c\\) independent" 1 "gimple" } } + do i3_4_c = 1, 100 + !$acc loop private(j3_4_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_c\\) independent" 1 "gimple" } } + do j3_4_c = 1, 100 + !$acc loop private(k3_4_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_c\\) independent" 1 "gimple" } } + do k3_4_c = 1, 100 + end do + end do + end do + + !$acc kernels ! Explicit "private(i3_5_s)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i3_5_s\\)" 1 "original" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "private\\(i3_5_s\\)" 1 "gimple" { xfail *-*-* } } } ! PR90067 + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_kernels map\\(force_tofrom:i3_5_s \\\[len: \[0-9\]+\\\]\\)" 0 "gimple" { xfail *-*-* } } } ! PR90067 + do i3_5_s = 1, 100 + !$acc loop private(j3_5_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_5_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_5_s\\) independent" 1 "gimple" } } + do j3_5_s = 1, 100 + !$acc loop private(k3_5_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_5_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_5_s\\) independent" 1 "gimple" } } + do k3_5_s = 1, 100 + end do + end do + end do + !$acc end kernels +end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/private-explicit-parallel-1.f95 b/gcc/testsuite/gfortran.dg/goacc/private-explicit-parallel-1.f95 new file mode 100644 index 00000000000..bac919b645d --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/private-explicit-parallel-1.f95 @@ -0,0 +1,247 @@ +! Explicit 'private' clauses related to 'do' loops inside an OpenACC +! 'parallel' construct. + +! { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } + +! (The 'independent' clauses are used as end of directive markers in tree dump +! scanning.) + +program test + implicit none + integer :: i0_1 + integer :: i0_2, j0_2 + integer :: i1_s + integer :: i1_c + integer :: i2_1_s, j2_1_s + integer :: i2_1_c, j2_1_c + integer :: i2_2_s, j2_2_s + integer :: i2_3_s, j2_3_s + integer :: i2_3_c, j2_3_c + integer :: i3_1_s, j3_1_s, k3_1_s + integer :: i3_1_c, j3_1_c, k3_1_c + integer :: i3_2_s, j3_2_s, k3_2_s + integer :: i3_2_c, j3_2_c, k3_2_c + integer :: i3_3_s, j3_3_s, k3_3_s + integer :: i3_3_c, j3_3_c, k3_3_c + integer :: i3_4_s, j3_4_s, k3_4_s + integer :: i3_4_c, j3_4_c, k3_4_c + integer :: i3_5_s, j3_5_s, k3_5_s + + !$acc parallel private(i0_1) + ! { dg-final { scan-tree-dump-times "#pragma acc parallel private\\(i0_1\\)" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_parallel private\\(i0_1\\)" 1 "gimple" } } + ! { dg-final { scan-tree-dump-times "firstprivate\\(i0_1\\)" 0 "gimple" } } + do i0_1 = 1, 100 + end do + !$acc end parallel + + !$acc parallel private(i0_2, j0_2) + ! { dg-final { scan-tree-dump-times "#pragma acc parallel private\\(i0_2\\) private\\(j0_2\\)" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_parallel private\\(i0_2\\) private\\(j0_2\\)" 1 "gimple" } } + ! { dg-final { scan-tree-dump-times "firstprivate\\(i0_2\\)" 0 "gimple" } } + ! { dg-final { scan-tree-dump-times "firstprivate\\(j0_2\\)" 0 "gimple" } } + do i0_2 = 1, 100 + do j0_2 = 1, 100 + end do + end do + !$acc end parallel + + !$acc parallel + !$acc loop private(i1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_s\\) independent" 1 "gimple" } } + do i1_s = 1, 100 + end do + !$acc end parallel + + !$acc parallel loop private(i1_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_c\\) independent" 1 "gimple" } } + do i1_c = 1, 100 + end do + + !$acc parallel + !$acc loop private(i2_1_s, j2_1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_s\\) private\\(j2_1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_s\\) private\\(j2_1_s\\) independent" 1 "gimple" } } + do i2_1_s = 1, 100 + do j2_1_s = 1, 100 + end do + end do + !$acc end parallel + + !$acc parallel loop private(i2_1_c, j2_1_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_c\\) private\\(j2_1_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_c\\) private\\(j2_1_c\\) independent" 1 "gimple" } } + do i2_1_c = 1, 100 + do j2_1_c = 1, 100 + end do + end do + + !$acc parallel private(i2_2_s) + ! { dg-final { scan-tree-dump-times "#pragma acc parallel private\\(i2_2_s\\)" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_parallel private\\(i2_2_s\\)" 1 "gimple" } } + ! { dg-final { scan-tree-dump-times "firstprivate\\(i2_2_s\\)" 0 "gimple" } } + do i2_2_s = 1, 100 + !$acc loop private(j2_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_2_s\\) independent" 1 "gimple" } } + do j2_2_s = 1, 100 + end do + end do + !$acc end parallel + + !$acc parallel + !$acc loop private(i2_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_s\\) independent" 1 "gimple" } } + do i2_3_s = 1, 100 + !$acc loop private(j2_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_s\\) independent" 1 "gimple" } } + do j2_3_s = 1, 100 + end do + end do + !$acc end parallel + + !$acc parallel loop private(i2_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_c\\) independent" 1 "gimple" } } + do i2_3_c = 1, 100 + !$acc loop private(j2_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_c\\) independent" 1 "gimple" } } + do j2_3_c = 1, 100 + end do + end do + + !$acc parallel + !$acc loop private(i3_1_s, j3_1_s, k3_1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_s\\) private\\(j3_1_s\\) private\\(k3_1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_s\\) private\\(j3_1_s\\) private\\(k3_1_s\\) independent" 1 "gimple" } } + do i3_1_s = 1, 100 + do j3_1_s = 1, 100 + do k3_1_s = 1, 100 + end do + end do + end do + !$acc end parallel + + !$acc parallel loop private(i3_1_c, j3_1_c, k3_1_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_c\\) private\\(j3_1_c\\) private\\(k3_1_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_c\\) private\\(j3_1_c\\) private\\(k3_1_c\\) independent" 1 "gimple" } } + do i3_1_c = 1, 100 + do j3_1_c = 1, 100 + do k3_1_c = 1, 100 + end do + end do + end do + + !$acc parallel + !$acc loop private(i3_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_s\\) independent" 1 "gimple" } } + do i3_2_s = 1, 100 + !$acc loop private(j3_2_s, k3_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_s\\) private\\(k3_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_s\\) private\\(k3_2_s\\) independent" 1 "gimple" } } + do j3_2_s = 1, 100 + do k3_2_s = 1, 100 + end do + end do + end do + !$acc end parallel + + !$acc parallel loop private(i3_2_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_c\\) independent" 1 "gimple" } } + do i3_2_c = 1, 100 + !$acc loop private(j3_2_c, k3_2_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_c\\) private\\(k3_2_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_c\\) private\\(k3_2_c\\) independent" 1 "gimple" } } + do j3_2_c = 1, 100 + do k3_2_c = 1, 100 + end do + end do + end do + + !$acc parallel + !$acc loop private(i3_3_s, j3_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_s\\) private\\(j3_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_s\\) private\\(j3_3_s\\) independent" 1 "gimple" } } + do i3_3_s = 1, 100 + do j3_3_s = 1, 100 + !$acc loop private(k3_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_s\\) independent" 1 "gimple" } } + do k3_3_s = 1, 100 + end do + end do + end do + !$acc end parallel + + !$acc parallel loop private(i3_3_c, j3_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_c\\) private\\(j3_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_c\\) private\\(j3_3_c\\) independent" 1 "gimple" } } + do i3_3_c = 1, 100 + do j3_3_c = 1, 100 + !$acc loop private(k3_3_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_c\\) independent" 1 "gimple" } } + do k3_3_c = 1, 100 + end do + end do + end do + + !$acc parallel + !$acc loop private(i3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_s\\) independent" 1 "gimple" } } + do i3_4_s = 1, 100 + !$acc loop private(j3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_s\\) independent" 1 "gimple" } } + do j3_4_s = 1, 100 + !$acc loop private(k3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_s\\) independent" 1 "gimple" } } + do k3_4_s = 1, 100 + end do + end do + end do + !$acc end parallel + + !$acc parallel loop private(i3_4_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_c\\) independent" 1 "gimple" } } + do i3_4_c = 1, 100 + !$acc loop private(j3_4_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_c\\) independent" 1 "gimple" } } + do j3_4_c = 1, 100 + !$acc loop private(k3_4_c) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_c\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_c\\) independent" 1 "gimple" } } + do k3_4_c = 1, 100 + end do + end do + end do + + !$acc parallel private(i3_5_s) + ! { dg-final { scan-tree-dump-times "#pragma acc parallel private\\(i3_5_s\\)" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma omp target oacc_parallel private\\(i3_5_s\\)" 1 "gimple" } } + ! { dg-final { scan-tree-dump-times "firstprivate\\(i3_5_s\\)" 0 "gimple" } } + do i3_5_s = 1, 100 + !$acc loop private(j3_5_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_5_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_5_s\\) independent" 1 "gimple" } } + do j3_5_s = 1, 100 + !$acc loop private(k3_5_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_5_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_5_s\\) independent" 1 "gimple" } } + do k3_5_s = 1, 100 + end do + end do + end do + !$acc end parallel +end program test diff --git a/gcc/testsuite/gfortran.dg/goacc/private-explicit-routine-1.f95 b/gcc/testsuite/gfortran.dg/goacc/private-explicit-routine-1.f95 new file mode 100644 index 00000000000..b7f8c3d5b37 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc/private-explicit-routine-1.f95 @@ -0,0 +1,146 @@ +! Explicit 'private' clauses related to 'do' loops inside an OpenACC +! accelerator routine. + +! { dg-additional-options "-fdump-tree-original -fdump-tree-gimple" } + +! (The 'independent' clauses are used as end of directive markers in tree dump +! scanning.) + +! The PR90114 XFAILs need to scan for the appropriate predetermined private +! level. + +subroutine test + implicit none + integer :: i0_1 + integer :: i0_2, j0_2 + integer :: i1_s + integer :: i2_1_s, j2_1_s + integer :: i2_2_s, j2_2_s + integer :: i2_3_s, j2_3_s + integer :: i3_1_s, j3_1_s, k3_1_s + integer :: i3_2_s, j3_2_s, k3_2_s + integer :: i3_3_s, j3_3_s, k3_3_s + integer :: i3_4_s, j3_4_s, k3_4_s + integer :: i3_5_s, j3_5_s, k3_5_s + !$acc routine gang + + ! Explicit "private(i0_1)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i0_1\\)" 1 "original" { xfail *-*-* } } } ! PR90114 + ! { dg-final { scan-tree-dump-times "private\\(i0_1\\)" 1 "gimple" { xfail *-*-* } } } ! PR90114 + do i0_1 = 1, 100 + end do + + ! Explicit "private(i0_2, j0_2)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i0_2\\)" 1 "original" { xfail *-*-* } } } ! PR90114 + ! { dg-final { scan-tree-dump-times "private\\(j0_2\\)" 1 "original" { xfail *-*-* } } } ! PR90114 + ! { dg-final { scan-tree-dump-times "private\\(i0_2\\)" 1 "gimple" { xfail *-*-* } } } ! PR90114 + ! { dg-final { scan-tree-dump-times "private\\(j0_2\\)" 1 "gimple" { xfail *-*-* } } } ! PR90114 + do i0_2 = 1, 100 + do j0_2 = 1, 100 + end do + end do + + !$acc loop private(i1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i1_s\\) independent" 1 "gimple" } } + do i1_s = 1, 100 + end do + + !$acc loop private(i2_1_s, j2_1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_s\\) private\\(j2_1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_1_s\\) private\\(j2_1_s\\) independent" 1 "gimple" } } + do i2_1_s = 1, 100 + do j2_1_s = 1, 100 + end do + end do + + ! Explicit "private(i2_2_s)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i2_2_s\\)" 1 "original" { xfail *-*-* } } } ! PR90114 + ! { dg-final { scan-tree-dump-times "private\\(i2_2_s\\)" 1 "gimple" { xfail *-*-* } } } ! PR90114 + do i2_2_s = 1, 100 + !$acc loop private(j2_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_2_s\\) independent" 1 "gimple" } } + do j2_2_s = 1, 100 + end do + end do + + !$acc loop private(i2_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i2_3_s\\) independent" 1 "gimple" } } + do i2_3_s = 1, 100 + !$acc loop private(j2_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j2_3_s\\) independent" 1 "gimple" } } + do j2_3_s = 1, 100 + end do + end do + + !$acc loop private(i3_1_s, j3_1_s, k3_1_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_s\\) private\\(j3_1_s\\) private\\(k3_1_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_1_s\\) private\\(j3_1_s\\) private\\(k3_1_s\\) independent" 1 "gimple" } } + do i3_1_s = 1, 100 + do j3_1_s = 1, 100 + do k3_1_s = 1, 100 + end do + end do + end do + + !$acc loop private(i3_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_2_s\\) independent" 1 "gimple" } } + do i3_2_s = 1, 100 + !$acc loop private(j3_2_s, k3_2_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_s\\) private\\(k3_2_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_2_s\\) private\\(k3_2_s\\) independent" 1 "gimple" } } + do j3_2_s = 1, 100 + do k3_2_s = 1, 100 + end do + end do + end do + + !$acc loop private(i3_3_s, j3_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_s\\) private\\(j3_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_3_s\\) private\\(j3_3_s\\) independent" 1 "gimple" } } + do i3_3_s = 1, 100 + do j3_3_s = 1, 100 + !$acc loop private(k3_3_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_3_s\\) independent" 1 "gimple" } } + do k3_3_s = 1, 100 + end do + end do + end do + + !$acc loop private(i3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(i3_4_s\\) independent" 1 "gimple" } } + do i3_4_s = 1, 100 + !$acc loop private(j3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_4_s\\) independent" 1 "gimple" } } + do j3_4_s = 1, 100 + !$acc loop private(k3_4_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_4_s\\) independent" 1 "gimple" } } + do k3_4_s = 1, 100 + end do + end do + end do + + ! Explicit "private(i3_5_s)" clause cannot be specified here. + ! { dg-final { scan-tree-dump-times "private\\(i3_5_s\\)" 1 "original" { xfail *-*-* } } } ! PR90114 + ! { dg-final { scan-tree-dump-times "private\\(i3_5_s\\)" 1 "gimple" { xfail *-*-* } } } ! PR90114 + do i3_5_s = 1, 100 + !$acc loop private(j3_5_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_5_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(j3_5_s\\) independent" 1 "gimple" } } + do j3_5_s = 1, 100 + !$acc loop private(k3_5_s) independent + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_5_s\\) independent" 1 "original" } } + ! { dg-final { scan-tree-dump-times "#pragma acc loop private\\(k3_5_s\\) independent" 1 "gimple" } } + do k3_5_s = 1, 100 + end do + end do + end do +end subroutine test