diff mbox

[Fortran] PR64726 Fix OpenACC's "parallel/kernel loop"

Message ID 54C158B8.3040909@net-b.de
State New
Headers show

Commit Message

Tobias Burnus Jan. 22, 2015, 8:08 p.m. UTC
"parallel/kernel loop" is handled by the function being patched (an 
assert ensures that no other directives end here). The first part of the 
function handles the parallel and kernel part, the loop itself should be 
handled by the called function. However, it currently passes the 
"kernel/parallel loop" op on, instead of only the "loop" part. That 
fails in the called function in an assert.

Build and regtested on x86-64-gnu-linux.
OK for the trunk?

Tobias

Comments

Cesar Philippidis Jan. 22, 2015, 10:17 p.m. UTC | #1
On 01/22/2015 12:08 PM, Tobias Burnus wrote:
> "parallel/kernel loop" is handled by the function being patched (an
> assert ensures that no other directives end here). The first part of the
> function handles the parallel and kernel part, the loop itself should be
> handled by the called function. However, it currently passes the
> "kernel/parallel loop" op on, instead of only the "loop" part. That
> fails in the called function in an assert.
> 
> Build and regtested on x86-64-gnu-linux.
> OK for the trunk?

It looks OK to me. In fact, I have an identical patch in our internal
branch and I don't know why it didn't make its way upstream or at least
into gomp-4_0-branch. Maybe it got lost after stage 1 closed. Sorry
about that.

Cesar
Tobias Burnus Jan. 23, 2015, 7:05 a.m. UTC | #2
Cesar Philippidis wrote:
> It looks OK to me. In fact, I have an identical patch in our internal 
> branch and I don't know why it didn't make its way upstream or at 
> least into gomp-4_0-branch. Maybe it got lost after stage 1 closed.

I have now committed it as Rev. 220028.

Tobias
diff mbox

Patch

2015-01-22  Tobias Burnus  <burnus@net-b.de>

	PR fortran/64726
	* trans-openmp.c (gfc_trans_oacc_combined_directive): Fix
	loop generation.

2015-01-22  Tobias Burnus  <burnus@net-b.de>

	PR fortran/64726
	* gfortran.dg/goacc/combined_loop.f90: New.

diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c
index fe47a96..cdd1885 100644
--- a/gcc/fortran/trans-openmp.c
+++ b/gcc/fortran/trans-openmp.c
@@ -3438,7 +3438,7 @@  gfc_trans_oacc_combined_directive (gfc_code *code)
     pblock = &block;
   else
     pushlevel ();
-  stmt = gfc_trans_omp_do (code, code->op, pblock, &loop_clauses, NULL);
+  stmt = gfc_trans_omp_do (code, EXEC_OACC_LOOP, pblock, &loop_clauses, NULL);
   if (TREE_CODE (stmt) != BIND_EXPR)
     stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0));
   else
diff --git a/gcc/testsuite/gfortran.dg/goacc/combined_loop.f90 b/gcc/testsuite/gfortran.dg/goacc/combined_loop.f90
new file mode 100644
index 0000000..b8be649
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/goacc/combined_loop.f90
@@ -0,0 +1,12 @@ 
+! { dg-do compile } 
+!
+! PR fortran/64726
+!
+subroutine oacc1()
+  implicit none
+  integer :: i
+  integer  :: a
+  !$acc parallel loop reduction(+:a) ! { dg-excess-errors "sorry, unimplemented: directive not yet implemented" }
+  do i = 1,5
+  enddo
+end subroutine oacc1