diff mbox series

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

Message ID 20190713063451.GG2125@tucnak
State New
Headers show
Series Fix OpenMP target parallel reduction (task, ...) (PR c/91149) | expand

Commit Message

Jakub Jelinek July 13, 2019, 6:34 a.m. UTC
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.


	Jakub
diff mbox series

Patch

--- 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++;
+}