[openacc] update fortran nested parallelism error messages

Message ID ade765a7-a04a-c2d7-1cbf-008531aa833e@codesourcery.com
State New
Headers show
Series
  • [openacc] update fortran nested parallelism error messages
Related show

Commit Message

Cesar Philippidis Sept. 24, 2018, 2:49 p.m.
Bernhard noticed a typo in one of the OpenACC parallelism error
messages. The error should have reported that gang loops cannot be
nested inside vector loops, not worker loops.

I'll commit the attached patch to trunk as obvious. I bootstrapped and
regtested it against x86_64 Linux with nvptx offloading.

Cesar

Patch

[OpenACC] update fortran nested parallelism error messages

2018-09-24  Bernhard Reuther-Fischer  <aldot@gcc.gnu.org>
	    Cesar Philippidis  <cesar@codesourcery.com>

	gcc/fortran/
	* openmp.c (resolve_oacc_loop_blocks):

	gcc/testsuite/
	* gfortran.dg/goacc/nested-parallelism.f90: New test.

---
 gcc/fortran/openmp.c                          |  2 +-
 .../gfortran.dg/goacc/nested-parallelism.f90  | 51 +++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
 create mode 100644 gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90

diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index ac1923ea06b..a046863445d 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -5913,7 +5913,7 @@  resolve_oacc_loop_blocks (gfc_code *code)
 			     &code->loc);
 		if (c->code->ext.omp_clauses->vector)
 		  gfc_error ("Loop parallelized across gangs is not allowed "
-			     "inside loop parallelized across workers at %L",
+			     "inside loop parallelized across vectors at %L",
 			     &code->loc);
 	      }
 	    if (code->ext.omp_clauses->worker)
diff --git a/gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90 b/gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90
new file mode 100644
index 00000000000..6ebef6a4547
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/nested-parallelism.f90
@@ -0,0 +1,51 @@ 
+! Verify the invalid gang, worker, vector parallelism error messages.
+
+program np
+  integer, parameter :: n = 100
+  integer :: i, j, k
+
+  !$acc parallel loop gang
+  do i = 1, n
+     !$acc loop gang ! { dg-error "gangs is not allowed inside another loop parallelized across gangs" }
+     do j = 1, n
+     end do
+
+     !$acc loop worker
+     do j = 1, n
+     end do
+
+     !$acc loop vector
+     do j = 1, n
+     end do     
+  end do
+  
+  !$acc parallel loop worker
+  do i = 1, n
+     !$acc loop gang ! { dg-error "gangs is not allowed inside loop parallelized across workers" }
+     do j = 1, n
+     end do
+
+     !$acc loop worker ! { dg-error "workers is not allowed inside another loop parallelized across workers" }
+     do j = 1, n
+     end do
+
+     !$acc loop vector
+     do j = 1, n
+     end do     
+  end do
+
+  !$acc parallel loop vector
+  do i = 1, n
+     !$acc loop gang ! { dg-error "gangs is not allowed inside loop parallelized across vectors" }
+     do j = 1, n
+     end do
+
+     !$acc loop worker ! { dg-error "workers is not allowed inside another loop parallelized across vectors" }
+     do j = 1, n
+     end do
+
+     !$acc loop vector ! { dg-error "vectors is not allowed inside another loop parallelized across vectors" }
+     do j = 1, n
+     end do     
+  end do
+end program np
-- 
2.17.1