https://gcc.gnu.org/g:318087911456a67455b53d86f4be882f6db0c5c7

commit 318087911456a67455b53d86f4be882f6db0c5c7
Author: Cesar Philippidis <ce...@codesourcery.com>
Date:   Tue Apr 15 15:56:38 2025 +0000

    Reference reduction localization
    
    gcc/ChangeLog
            * gimplify.cc (privatize_reduction): New struct.
            (localize_reductions_r, localize_reductions): New functions.
            (gimplify_omp_for): Call localize_reductions.
            (gimplify_omp_workshare): Likewise.
            * omp-low.cc (lower_oacc_reductions): Handle localized reductions.
            Create fewer temp vars.
            * tree-core.h (omp_clause_code): Add 
OMP_CLAUSE_REDUCTION_PRIVATE_DECL
            documentation.
            * tree.cc (omp_clause_num_ops): Bump number of ops for
            OMP_CLAUSE_REDUCTION to 6.
            (walk_tree_1): Adjust accordingly.
            * tree.h (OMP_CLAUSE_REDUCTION_PRIVATE_DECL): Add macro.
    
    gcc/testsuite/ChangeLog
            * gfortran.dg/goacc/modules.f95: Remove xfail on bogus warnings.
    
    libgomp/ChangeLog
            * testsuite/libgomp.oacc-fortran/optional-reduction.f90: Remove
            xfail on bogus warnings.
            * testsuite/libgomp.oacc-fortran/parallel-reduction.f90: Likewise.
            * testsuite/libgomp.oacc-fortran/pr70643.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.
    
    Co-Authored-By: Julian Brown <jul...@codesourcery.com>
    Co-Authored-By: Sandra Loosemore <sloosem...@baylibre.com>

Diff:
---
 gcc/gimplify.cc                                    | 102 +++++++++++++++++++++
 gcc/omp-low.cc                                     |  45 +++------
 gcc/testsuite/gfortran.dg/goacc/modules.f95        |   3 +-
 gcc/tree-core.h                                    |   4 +-
 gcc/tree.cc                                        |   2 +-
 gcc/tree.h                                         |   2 +
 .../libgomp.oacc-fortran/optional-reduction.f90    |  12 +--
 .../libgomp.oacc-fortran/parallel-reduction.f90    |   8 +-
 libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90 |   3 +-
 .../testsuite/libgomp.oacc-fortran/reduction-5.f90 |  18 ++--
 .../testsuite/libgomp.oacc-fortran/reduction-7.f90 |   6 +-
 .../libgomp.oacc-fortran/reference-reductions.f90  |   6 +-
 12 files changed, 139 insertions(+), 72 deletions(-)

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index 8afa9932916b..2a351b000fe1 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -295,6 +295,11 @@ struct gimplify_omp_ctx
   int defaultmap[5];
 };
 
+struct privatize_reduction
+{
+  tree ref_var, local_var;
+};
+
 static struct gimplify_ctx *gimplify_ctxp;
 static struct gimplify_omp_ctx *gimplify_omp_ctxp;
 static bool in_omp_construct;
@@ -16167,6 +16172,80 @@ gimplify_omp_loop_xform (tree *expr_p, gimple_seq 
*pre_p)
   return GS_ALL_DONE;
 }
 
+/* Helper function for localize_reductions.  Replace all uses of REF_VAR with
+   LOCAL_VAR.  */
+
+static tree
+localize_reductions_r (tree *tp, int *walk_subtrees, void *data)
+{
+  enum tree_code tc = TREE_CODE (*tp);
+  struct privatize_reduction *pr = (struct privatize_reduction *) data;
+
+  if (TYPE_P (*tp))
+    *walk_subtrees = 0;
+
+  switch (tc)
+    {
+    case INDIRECT_REF:
+    case MEM_REF:
+      if (TREE_OPERAND (*tp, 0) == pr->ref_var)
+       *tp = pr->local_var;
+
+      *walk_subtrees = 0;
+      break;
+
+    case VAR_DECL:
+    case PARM_DECL:
+    case RESULT_DECL:
+      if (*tp == pr->ref_var)
+       *tp = pr->local_var;
+
+      *walk_subtrees = 0;
+      break;
+
+    default:
+      break;
+    }
+
+  return NULL_TREE;
+}
+
+/* OpenACC worker and vector loop state propagation requires reductions
+   to be inside local variables.  This function replaces all reference-type
+   reductions variables associated with the loop with a local copy.  It is
+   also used to create private copies of reduction variables for those
+   which are not associated with acc loops.  */
+
+static void
+localize_reductions (tree clauses, tree body)
+{
+  tree c, var, type, new_var;
+  struct privatize_reduction pr;
+
+  for (c = clauses; c; c = OMP_CLAUSE_CHAIN (c))
+    if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION)
+      {
+       var = OMP_CLAUSE_DECL (c);
+
+       if (!lang_hooks.decls.omp_privatize_by_reference (var))
+         {
+           OMP_CLAUSE_REDUCTION_PRIVATE_DECL (c) = NULL;
+           continue;
+         }
+
+       type = TREE_TYPE (TREE_TYPE (var));
+       new_var = create_tmp_var (type, IDENTIFIER_POINTER (DECL_NAME (var)));
+
+       pr.ref_var = var;
+       pr.local_var = new_var;
+
+       walk_tree (&body, localize_reductions_r, &pr, NULL);
+
+       OMP_CLAUSE_REDUCTION_PRIVATE_DECL (c) = new_var;
+      }
+}
+
+
 /* Gimplify the gross structure of an OMP_FOR statement.  */
 
 static enum gimplify_status
@@ -16426,6 +16505,24 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p)
       gcc_unreachable ();
     }
 
+  if (ort == ORT_ACC)
+    {
+      gimplify_omp_ctx *outer = gimplify_omp_ctxp;
+
+      while (outer
+            && outer->region_type != ORT_ACC_PARALLEL
+            && outer->region_type != ORT_ACC_KERNELS)
+       outer = outer->outer_context;
+
+      /* FIXME: Reductions only work in parallel regions at present.  We avoid
+        doing the reduction localization transformation in kernels regions
+        here, because the code to remove reductions in kernels regions cannot
+        handle that.  */
+      if (outer && outer->region_type == ORT_ACC_PARALLEL)
+       localize_reductions (OMP_FOR_CLAUSES (for_stmt),
+                            OMP_FOR_BODY (for_stmt));
+    }
+
   /* Set OMP_CLAUSE_LINEAR_NO_COPYIN flag on explicit linear
      clause for the IV.  */
   if (ort == ORT_SIMD && TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)) == 1)
@@ -18038,6 +18135,11 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq 
*pre_p)
       || (ort & ORT_HOST_TEAMS) == ORT_HOST_TEAMS)
     {
       push_gimplify_context ();
+
+      /* FIXME: Reductions are not supported in kernels regions yet.  */
+      if (/*ort == ORT_ACC_KERNELS ||*/ ort == ORT_ACC_PARALLEL)
+       localize_reductions (OMP_CLAUSES (expr), OMP_BODY (expr));
+
       gimple *g = gimplify_and_return_first (OMP_BODY (expr), &body);
       if (gimple_code (g) == GIMPLE_BIND)
        pop_gimplify_context (g);
diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index 387517cf0679..01882516ae23 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -7658,9 +7658,9 @@ lower_oacc_reductions (location_t loc, tree clauses, tree 
level, bool inner,
        gcc_checking_assert (!is_oacc_kernels_decomposed_part (ctx));
 
        tree orig = OMP_CLAUSE_DECL (c);
-       tree var = maybe_lookup_decl (orig, ctx);
+       tree var;
        tree ref_to_res = NULL_TREE;
-       tree incoming, outgoing, v1, v2, v3;
+       tree incoming, outgoing;
        bool is_private = false;
        bool is_fpp = false;
 
@@ -7673,6 +7673,9 @@ lower_oacc_reductions (location_t loc, tree clauses, tree 
level, bool inner,
          rcode = BIT_IOR_EXPR;
        tree op = build_int_cst (unsigned_type_node, rcode);
 
+       var = OMP_CLAUSE_REDUCTION_PRIVATE_DECL (c);
+       if (!var)
+         var = maybe_lookup_decl (orig, ctx);
        if (!var)
          var = orig;
 
@@ -7781,37 +7784,13 @@ lower_oacc_reductions (location_t loc, tree clauses, 
tree level, bool inner,
        if (!ref_to_res)
          ref_to_res = integer_zero_node;
 
-       if (omp_privatize_by_reference (orig))
+       if (omp_privatize_by_reference (outgoing))
          {
-           tree type = TREE_TYPE (var);
-           const char *id = IDENTIFIER_POINTER (DECL_NAME (var));
-
-           if (!inner)
-             {
-               tree x = create_tmp_var (TREE_TYPE (type), id);
-               gimplify_assign (var, build_fold_addr_expr (x), fork_seq);
-             }
-
-           v1 = create_tmp_var (type, id);
-           v2 = create_tmp_var (type, id);
-           v3 = create_tmp_var (type, id);
-
-           gimplify_assign (v1, var, fork_seq);
-           gimplify_assign (v2, var, fork_seq);
-           gimplify_assign (v3, var, fork_seq);
-
-           var = build_simple_mem_ref (var);
-           v1 = build_simple_mem_ref (v1);
-           v2 = build_simple_mem_ref (v2);
-           v3 = build_simple_mem_ref (v3);
            outgoing = build_simple_mem_ref (outgoing);
 
            if (!TREE_CONSTANT (incoming))
              incoming = build_simple_mem_ref (incoming);
          }
-       else
-         /* Note that 'var' might be a mem ref.  */
-         v1 = v2 = v3 = var;
 
        /* Determine position in reduction buffer, which may be used
           by target.  The parser has ensured that this is not a
@@ -7845,21 +7824,21 @@ lower_oacc_reductions (location_t loc, tree clauses, 
tree level, bool inner,
          = build_call_expr_internal_loc (loc, IFN_GOACC_REDUCTION,
                                          TREE_TYPE (var), 6, init_code,
                                          unshare_expr (ref_to_res),
-                                         unshare_expr (v1), level, op, off);
+                                         unshare_expr (var), level, op, off);
        tree fini_call
          = build_call_expr_internal_loc (loc, IFN_GOACC_REDUCTION,
                                          TREE_TYPE (var), 6, fini_code,
                                          unshare_expr (ref_to_res),
-                                         unshare_expr (v2), level, op, off);
+                                         unshare_expr (var), level, op, off);
        tree teardown_call
          = build_call_expr_internal_loc (loc, IFN_GOACC_REDUCTION,
                                          TREE_TYPE (var), 6, teardown_code,
-                                         ref_to_res, unshare_expr (v3),
+                                         ref_to_res, unshare_expr (var),
                                          level, op, off);
 
-       gimplify_assign (unshare_expr (v1), setup_call, &before_fork);
-       gimplify_assign (unshare_expr (v2), init_call, &after_fork);
-       gimplify_assign (unshare_expr (v3), fini_call, &before_join);
+       gimplify_assign (unshare_expr (var), setup_call, &before_fork);
+       gimplify_assign (unshare_expr (var), init_call, &after_fork);
+       gimplify_assign (unshare_expr (var), fini_call, &before_join);
        gimplify_assign (unshare_expr (outgoing), teardown_call, &after_join);
       }
 
diff --git a/gcc/testsuite/gfortran.dg/goacc/modules.f95 
b/gcc/testsuite/gfortran.dg/goacc/modules.f95
index 1e8d82641553..42e715ef0861 100644
--- a/gcc/testsuite/gfortran.dg/goacc/modules.f95
+++ b/gcc/testsuite/gfortran.dg/goacc/modules.f95
@@ -18,8 +18,7 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   DO k=y_min,y_max
     DO j=x_min,x_max
       sum=sum*arr(j,k)
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index bd19c99d3262..2389441e986d 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -278,7 +278,9 @@ enum omp_clause_code {
                 placeholder used in OMP_CLAUSE_REDUCTION_{INIT,MERGE}.
      Operand 4: OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER: Another dummy
                VAR_DECL placeholder, used like the above for C/C++ array
-               reductions.  */
+               reductions.
+     Operand 5: OMP_CLAUSE_REDUCTION_PRIVATE_DECL: A private VAR_DECL of
+               the original DECL associated with the reduction clause.  */
   OMP_CLAUSE_REDUCTION,
 
   /* OpenMP clause: task_reduction (operator:variable_list).  */
diff --git a/gcc/tree.cc b/gcc/tree.cc
index eccfcc89da40..3e71d8d92cdd 100644
--- a/gcc/tree.cc
+++ b/gcc/tree.cc
@@ -301,7 +301,7 @@ unsigned const char omp_clause_num_ops[] =
   1, /* OMP_CLAUSE_SHARED  */
   1, /* OMP_CLAUSE_FIRSTPRIVATE  */
   2, /* OMP_CLAUSE_LASTPRIVATE  */
-  5, /* OMP_CLAUSE_REDUCTION  */
+  6, /* OMP_CLAUSE_REDUCTION  */
   5, /* OMP_CLAUSE_TASK_REDUCTION  */
   5, /* OMP_CLAUSE_IN_REDUCTION  */
   1, /* OMP_CLAUSE_COPYIN  */
diff --git a/gcc/tree.h b/gcc/tree.h
index 99f261776281..7f528f5c723a 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -1962,6 +1962,8 @@ class auto_suppress_location_wrappers
 #define OMP_CLAUSE_REDUCTION_DECL_PLACEHOLDER(NODE) \
   OMP_CLAUSE_OPERAND (OMP_CLAUSE_RANGE_CHECK (NODE, OMP_CLAUSE_REDUCTION, \
                                              OMP_CLAUSE_IN_REDUCTION), 4)
+#define OMP_CLAUSE_REDUCTION_PRIVATE_DECL(NODE) \
+  OMP_CLAUSE_OPERAND (OMP_CLAUSE_SUBCODE_CHECK (NODE, OMP_CLAUSE_REDUCTION), 5)
 
 /* True if a REDUCTION clause may reference the original list item (omp_orig)
    in its OMP_CLAUSE_REDUCTION_{,GIMPLE_}INIT.  */
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90 
b/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90
index 0bb05b9b869d..91564b294c1a 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/optional-reduction.f90
@@ -34,8 +34,7 @@ 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 }
+    ! { dg-bogus {'rg\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
     do i = 1, n
        rg = rg + array(i)
     end do
@@ -43,8 +42,7 @@ 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 }
+    ! { dg-bogus {'rw\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
     do i = 1, n
        rw = rw + array(i)
     end do
@@ -52,8 +50,7 @@ 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 }
+    ! { dg-bogus {'rv\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
     do i = 1, n
        rv = rv + array(i)
     end do
@@ -61,8 +58,7 @@ 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 }
+    ! { dg-bogus {'rc\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
     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 a7b7adebb09e..2b289c26d5da 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/parallel-reduction.f90
@@ -46,11 +46,9 @@ subroutine redsub(s1, s2, n)
   integer :: s1, s2, n
 
   !$acc parallel reduction(+:s1,s2) num_gangs (10)  copy(s1)
-  ! { 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 }
+  ! { dg-bogus {'s1\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
+  ! { dg-bogus {'s2\.[0-9]+' is used uninitialized} "" { target *-*-* } .-2 }
+  ! { dg-bogus "\[Ww\]arning: region is gang partitioned but does not contain 
gang partitioned code" "TODO 'reduction'" { xfail *-*-* } .-3 }
   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 5082e367e020..a9f00abe7f0a 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/pr70643.f90
@@ -18,8 +18,7 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   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/reduction-5.f90 
b/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90
index 88a691f7ca15..30fb30a8e12a 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/reduction-5.f90
@@ -38,8 +38,7 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   do i = 1, n
      sum = sum + c
   end do
@@ -54,8 +53,7 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   do i = 1, n
      sum = sum + c
   end do
@@ -69,8 +67,7 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   do i = 1, n
      sum = sum + c
   end do
@@ -84,8 +81,7 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   do i = 1, n
      sum = sum + c
   end do
@@ -102,12 +98,10 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   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 }
+     ! { dg-bogus {'sum\.[0-9]+' may be used uninitialized} "" { target { ! 
__OPTIMIZE__ } } .-1 }
      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 38148f520da8..03a58a58dbc0 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/reduction-7.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/reduction-7.f90
@@ -64,8 +64,7 @@ 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 }
+  ! { dg-bogus {'sum\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
   do i = 1, n
      sum = sum + 1
   end do
@@ -84,8 +83,7 @@ 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 }
+     ! { dg-bogus {'sum\.[0-9]+' may be used uninitialized} "" { target { ! 
__OPTIMIZE__ } } .-1 }
      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 055d22510c43..635b1b011792 100644
--- a/libgomp/testsuite/libgomp.oacc-fortran/reference-reductions.f90
+++ b/libgomp/testsuite/libgomp.oacc-fortran/reference-reductions.f90
@@ -16,12 +16,10 @@ 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 }
+  ! { dg-bogus {'var\.[0-9]+' is used uninitialized} "" { target *-*-* } .-1 }
  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 }
+    ! { dg-bogus {'var\.[0-9]+' may be used uninitialized} "" { target { ! 
__OPTIMIZE__ } } .-1 }
     do j=1,100
      var = var + 1.0
     enddo

Reply via email to