]> git.ipfire.org Git - thirdparty/gcc.git/commit
OpenMP/Fortran: Fix handling of optional is_device_ptr + bind(C) [PR108546]
authorTobias Burnus <tobias@codesourcery.com>
Wed, 1 Mar 2023 14:18:40 +0000 (15:18 +0100)
committerTobias Burnus <tobias@codesourcery.com>
Wed, 1 Mar 2023 14:18:40 +0000 (15:18 +0100)
commit15b6140ed5d5f006063835319fdd6486d1abceb9
tree78d72c9a8c275bce950c4e13e69d132458a50541
parentbaa7f7adf756899974f132bbacbb29f45aa3cd21
OpenMP/Fortran: Fix handling of optional is_device_ptr + bind(C) [PR108546]

For is_device_ptr, optional checks should only be done before calling
libgomp, afterwards they are NULL either because of absent or, by
chance, because it is unallocated or unassociated (for pointers/allocatables).

Additionally, it fixes an issue with explicit mapping for 'type(c_ptr)'.

PR middle-end/108546

gcc/fortran/ChangeLog:

* trans-openmp.cc (gfc_trans_omp_clauses): Fix mapping of
type(C_ptr) variables.

gcc/ChangeLog:

* omp-low.cc (lower_omp_target): Remove optional handling
on the receiver side, i.e. inside target (data), for
use_device_ptr.

libgomp/ChangeLog:

* testsuite/libgomp.fortran/is_device_ptr-3.f90: New test.
* testsuite/libgomp.fortran/use_device_ptr-optional-4.f90: New test.

(cherry picked from commit 96ff97ff6574666a5509ae9fa596e7f2b6ad4f88)
gcc/ChangeLog.omp
gcc/fortran/ChangeLog.omp
gcc/fortran/trans-openmp.cc
gcc/omp-low.cc
libgomp/ChangeLog.omp
libgomp/testsuite/libgomp.fortran/is_device_ptr-3.f90 [new file with mode: 0644]
libgomp/testsuite/libgomp.fortran/use_device_ptr-optional-4.f90 [new file with mode: 0644]