]> git.ipfire.org Git - thirdparty/gcc.git/commit
fortran: Fix up gfc_trans_oacc_construct [PR104717]
authorJakub Jelinek <jakub@redhat.com>
Wed, 20 Apr 2022 17:06:17 +0000 (19:06 +0200)
committerThomas Schwinge <thomas@codesourcery.com>
Mon, 25 Apr 2022 21:14:02 +0000 (23:14 +0200)
commitb2202431910e30d8505c94d1cb9341cac7080d10
tree0d32c5d40834f0b7a5d297398070378dd40e471d
parent68fd1c9f22ad42536bcb63a4c776004268702b0b
fortran: Fix up gfc_trans_oacc_construct [PR104717]

So that move_sese_region_to_fn works properly, OpenMP/OpenACC constructs
for which that function is invoked need an extra artificial BIND_EXPR
around their body so that we move all variables of the bodies.

The C/C++ FEs do that both for OpenMP constructs like OMP_PARALLEL, OMP_TASK
or OMP_TARGET and for OpenACC constructs that behave similarly to
OMP_TARGET, but the Fortran FE only does that for OpenMP constructs.

The following patch does that for OpenACC constructs too.

PR fortran/104717
gcc/fortran/
* trans-openmp.cc (gfc_trans_oacc_construct): Wrap construct body
in an extra BIND_EXPR.
gcc/testsuite/
* gfortran.dg/goacc/pr104717.f90: New test.
* gfortran.dg/goacc/privatization-1-compute-loop.f90: Adjust.
libgomp/
* testsuite/libgomp.oacc-fortran/privatized-ref-2.f90: Adjust.

Co-authored-by: Thomas Schwinge <thomas@codesourcery.com>
gcc/fortran/trans-openmp.cc
gcc/testsuite/gfortran.dg/goacc/pr104717.f90 [new file with mode: 0644]
gcc/testsuite/gfortran.dg/goacc/privatization-1-compute-loop.f90
libgomp/testsuite/libgomp.oacc-fortran/privatized-ref-2.f90