[OpenMP,Fortran] Fix several OpenMP use_device_addr/map/update errors
authorTobias Burnus <tobias@codesourcery.com>
Fri, 11 Oct 2019 09:17:49 +0000 (09:17 +0000)
committerTobias Burnus <burnus@gcc.gnu.org>
Fri, 11 Oct 2019 09:17:49 +0000 (11:17 +0200)
commit08c14aaaab2b01f1a31989a8d94bae312d87c8f7
tree57787b2cb0e1cad4b4370339157e8b47155b5e12
parentb67e2ad80d3e080c5258ff64ddb6f40e8d783e0b
[OpenMP,Fortran] Fix several OpenMP use_device_addr/map/update errors

gcc/fortran/
* f95-lang.c (LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR): Re-define to
gfc_omp_is_allocatable_or_ptr.
* trans-decl.c (create_function_arglist): Set GFC_DECL_OPTIONAL_ARGUMENT
only if not passed by value.
* trans-openmp.c (gfc_omp_is_allocatable_or_ptr): New.
(gfc_trans_omp_clauses): For MAP, handle (present) optional arguments;
for target update, handle allocatable/pointer scalars.
* trans.h (gfc_omp_is_allocatable_or_ptr): Declare.

gcc/
* langhooks-def.h (LANG_HOOKS_OMP_IS_ALLOCATABLE_OR_PTR): Define.
(LANG_HOOKS_DECLS): Add it.
* langhooks.h (lang_hooks_for_decls): Add omp_is_allocatable_or_ptr;
update comment for omp_is_optional_argument.
* omp-general.c (omp_is_allocatable_or_ptr): New.
* omp-general.h (omp_is_allocatable_or_ptr): Declare.
* omp-low.c (scan_sharing_clauses, lower_omp_target): Handle
Fortran's optional arguments and allocatable/pointer scalars
with use_device_addr.

libgomp/
* testsuite/libgomp.fortran/use_device_addr-1.f90: New.
* testsuite/libgomp.fortran/use_device_addr-2.f90: New.

From-SVN: r276875
14 files changed:
gcc/ChangeLog
gcc/fortran/ChangeLog
gcc/fortran/f95-lang.c
gcc/fortran/trans-decl.c
gcc/fortran/trans-openmp.c
gcc/fortran/trans.h
gcc/langhooks-def.h
gcc/langhooks.h
gcc/omp-general.c
gcc/omp-general.h
gcc/omp-low.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/use_device_addr-1.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/use_device_addr-2.f90 [new file with mode: 0644]