[OpenACC] Allow gang reductions inside serial constructs

... fixing a regression introduced in the preceding
commit 2b7dac2c0dcb087da9e4018943c023c0678234a3
"Make OpenACC orphan gang reductions errors".

	gcc/fortran/
	* openmp.c (oacc_is_serial, oacc_is_parallel_or_serial): New.
	(resolve_oacc_loop_blocks): Use oacc_is_parallel_or_serial instead of
	oacc_is_parallel.
	libgomp/
	* testsuite/libgomp.oacc-fortran/parallel-dims.f90: Remove
	temporary skip.

Co-Authored-By: Thomas Schwinge <thomas@codesourcery.com>
This commit is contained in:
Kwok Cheung Yeung 2020-03-13 11:13:49 -07:00 committed by Thomas Schwinge
parent 2b7dac2c0d
commit f1a58ab0db
2 changed files with 13 additions and 2 deletions

View File

@ -8334,6 +8334,18 @@ oacc_is_kernels (gfc_code *code)
return code->op == EXEC_OACC_KERNELS || code->op == EXEC_OACC_KERNELS_LOOP;
}
static bool
oacc_is_serial (gfc_code *code)
{
return code->op == EXEC_OACC_SERIAL || code->op == EXEC_OACC_SERIAL_LOOP;
}
static bool
oacc_is_parallel_or_serial (gfc_code *code)
{
return oacc_is_parallel (code) || oacc_is_serial (code);
}
static gfc_statement
omp_code_to_statement (gfc_code *code)
{
@ -8644,7 +8656,7 @@ resolve_oacc_loop_blocks (gfc_code *code)
for (c = omp_current_ctx; c; c = c->previous)
if (!oacc_is_loop (c->code))
break;
if (c == NULL || !(oacc_is_parallel (c->code)
if (c == NULL || !(oacc_is_parallel_or_serial (c->code)
|| oacc_is_kernels (c->code)))
gfc_error ("gang reduction on an orphan loop at %L", &code->loc);
}

View File

@ -3,7 +3,6 @@
! { dg-additional-sources parallel-dims-aux.c }
! { dg-do run }
! { dg-skip-if TODO { *-*-* } }
! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" }
! { dg-additional-options "-fopt-info-note-omp" }