https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108546
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Tobias Burnus <bur...@gcc.gnu.org>: https://gcc.gnu.org/g:96ff97ff6574666a5509ae9fa596e7f2b6ad4f88 commit r13-6390-g96ff97ff6574666a5509ae9fa596e7f2b6ad4f88 Author: Tobias Burnus <tob...@codesourcery.com> Date: Wed Mar 1 13:53:09 2023 +0100 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.