Hi!

in_reduction and task_reduction clauses need to be handled the same as
reduction clause.

Fixed thusly, tested on x86_64-linux, committed to trunk.

2019-10-14  Jakub Jelinek  <ja...@redhat.com>

        PR c++/92084
        * semantics.c (handle_omp_array_sections_1): Temporarily disable
        -fstrong-eval-order also for in_reduction and task_reduction clauses.

        * g++.dg/gomp/pr92084.C: New test.

--- gcc/cp/semantics.c.jj       2019-10-11 09:35:14.415498936 +0200
+++ gcc/cp/semantics.c  2019-10-14 10:11:32.396100623 +0200
@@ -5068,7 +5068,9 @@ handle_omp_array_sections_1 (tree c, tre
      saying how many times the side-effects are evaluated is unspecified,
      makes int *a, *b; ... reduction(+:a[a = b, 3:10]) really unspecified.  */
   warning_sentinel s (flag_strong_eval_order,
-                     OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION);
+                     OMP_CLAUSE_CODE (c) == OMP_CLAUSE_REDUCTION
+                     || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_IN_REDUCTION
+                     || OMP_CLAUSE_CODE (c) == OMP_CLAUSE_TASK_REDUCTION);
   ret = grok_array_decl (OMP_CLAUSE_LOCATION (c), ret, low_bound, false);
   return ret;
 }
--- gcc/testsuite/g++.dg/gomp/pr92084.C.jj      2019-10-14 10:13:38.210217838 
+0200
+++ gcc/testsuite/g++.dg/gomp/pr92084.C 2019-10-14 10:13:30.602331688 +0200
@@ -0,0 +1,11 @@
+// PR c++/92084
+
+void bar (int *, int);
+int baz (int);
+
+void
+foo (int *x, int y)
+{
+#pragma omp taskgroup task_reduction (*: x[baz (y)])
+  bar (x, baz (y));
+}

        Jakub

Reply via email to