]> git.ipfire.org Git - thirdparty/gcc.git/commit
libgomp, Fortran: Fix OpenACC "gang reduction on an orphan loop" error message
authorFrederik Harwath <frederik@codesourcery.com>
Mon, 20 Jul 2020 09:24:21 +0000 (11:24 +0200)
committerFrederik Harwath <frederik@codesourcery.com>
Mon, 20 Jul 2020 09:32:23 +0000 (11:32 +0200)
commit7c10ae450b95495dda362cb66770bb78b546592e
tree0fab758c2d9688f334833448a7653fbaf6dee832
parentd7aaef810db54c9039c71ab72c13022b1fa24f1d
libgomp, Fortran: Fix OpenACC "gang reduction on an orphan loop" error message

According to the OpenACC standard version 2.5 and later, reductions on
orphaned gang loops are explicitly disallowed (cf.  section "Changes
from Version 2.0 to 2.5").  A loop is "orphaned" if it is not
lexically contained in a compute construct (cf. section "Loop
construct" of the OpenACC standard), i.e. in either a "parallel", a
"serial", or a "kernels" construct.

This commit fixes the check for reductions on orphaned gang loops in
the Fortran frontend which (in contrast to the C, C++ frontends)
erroneously rejects reductions on gang loops that are contained in
"kernels" constructs.

2020-07-20  Frederik Harwath  <frederik@codesourcery.com>

gcc/fortran/

* openmp.c (oacc_is_parallel_or_serial): Removed function.
(oacc_is_kernels): New function.
(oacc_is_compute_construct): New function.
(resolve_oacc_loop_blocks): Use "oacc_is_compute_construct"
instead of "oacc_is_parallel_or_serial" for checking that a
loop is not orphaned.

gcc/testsuite/

* gfortran.dg/goacc/orphan-reductions-2.f90: New test
verifying that the "gang reduction on an orphan loop" error message
is not emitted for non-orphaned loops.

* c-c++-common/goacc/orphan-reductions-2.c: Likewise for C and C++.
gcc/fortran/ChangeLog
gcc/fortran/openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/c-c++-common/goacc/orphan-reductions-2.c [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/orphan-reductions-2.f90 [new file with mode: 0644]