diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2023-03-01 13:53:09 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2023-03-01 13:53:09 +0100 |
commit | 96ff97ff6574666a5509ae9fa596e7f2b6ad4f88 (patch) | |
tree | c26a5a27dcad86aac7dde1325122e757a94c48e9 /gcc | |
parent | f72c8918416f67aad907752f1892c19eda12eecb (diff) | |
download | gcc-96ff97ff6574666a5509ae9fa596e7f2b6ad4f88.zip gcc-96ff97ff6574666a5509ae9fa596e7f2b6ad4f88.tar.gz gcc-96ff97ff6574666a5509ae9fa596e7f2b6ad4f88.tar.bz2 |
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.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/trans-openmp.cc | 4 | ||||
-rw-r--r-- | gcc/omp-low.cc | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc index 2d16f3b..84c0184 100644 --- a/gcc/fortran/trans-openmp.cc +++ b/gcc/fortran/trans-openmp.cc @@ -3152,7 +3152,9 @@ gfc_trans_omp_clauses (stmtblock_t *block, gfc_omp_clauses *clauses, || GFC_DECL_CRAY_POINTEE (decl) || GFC_DESCRIPTOR_TYPE_P (TREE_TYPE (TREE_TYPE (decl))) - || n->sym->ts.type == BT_DERIVED)) + || (n->sym->ts.type == BT_DERIVED + && (n->sym->ts.u.derived->ts.f90_type + != BT_VOID)))) { tree orig_decl = decl; diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc index fef41a0..9757592 100644 --- a/gcc/omp-low.cc +++ b/gcc/omp-low.cc @@ -13942,7 +13942,8 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx) } tree present; present = ((do_optional_check - && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_HAS_DEVICE_ADDR) + && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_HAS_DEVICE_ADDR + && OMP_CLAUSE_CODE (c) != OMP_CLAUSE_IS_DEVICE_PTR) ? omp_check_optional_argument (OMP_CLAUSE_DECL (c), true) : NULL_TREE); if (present) |