This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix OpenMP target parallel reduction (task, ...) (PR c/91149)


Hi!

I've discovered a pasto, which breaks the following testcase.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk, will backport to 9.2 too.

2019-07-13  Jakub Jelinek  <jakub@redhat.com>

	PR c/91149
	* c-omp.c (c_omp_split_clauses): Fix a pasto in
	OMP_CLAUSE_REDUCTION_TASK handling.

	* c-c++-common/gomp/reduction-task-3.c: New test.

--- gcc/c-family/c-omp.c.jj	2019-07-12 09:46:35.824602187 +0200
+++ gcc/c-family/c-omp.c	2019-07-12 16:07:14.494672183 +0200
@@ -1667,7 +1667,7 @@ c_omp_split_clauses (location_t loc, enu
 		}
 	      else if (code != OMP_SECTIONS
 		       && (mask & (OMP_CLAUSE_MASK_1
-				   << PRAGMA_OMP_CLAUSE_SCHEDULE)) == 0
+				   << PRAGMA_OMP_CLAUSE_NUM_THREADS)) == 0
 		       && (mask & (OMP_CLAUSE_MASK_1
 				   << PRAGMA_OMP_CLAUSE_SCHEDULE)) == 0)
 		{
--- gcc/testsuite/c-c++-common/gomp/reduction-task-3.c.jj	2019-07-12 16:22:44.005562884 +0200
+++ gcc/testsuite/c-c++-common/gomp/reduction-task-3.c	2019-07-12 16:16:24.447324301 +0200
@@ -0,0 +1,12 @@
+/* PR c/91149 */
+
+int r;
+
+void
+foo (void)
+{
+  #pragma omp parallel reduction(task, +: r)
+  r++;
+  #pragma omp target parallel reduction(task, +: r)
+  r++;
+}

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]