aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/trans-openmp.cc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-02-15 21:42:33 +0100
committerTobias Burnus <tobias@codesourcery.com>2022-02-15 21:42:33 +0100
commit4d74ea551734694c225643c4069b1b4d4d2b05ed (patch)
treee8ad92ca6683d0a8cdb3d27099cea1899fb5b649 /gcc/fortran/trans-openmp.cc
parent8e84b2b37a541b27feea69769fc314d534464ebd (diff)
downloadgcc-4d74ea551734694c225643c4069b1b4d4d2b05ed.zip
gcc-4d74ea551734694c225643c4069b1b4d4d2b05ed.tar.gz
gcc-4d74ea551734694c225643c4069b1b4d4d2b05ed.tar.bz2
Fortran/OpenMP: Fix depend-clause handling for c_ptr
gcc/fortran/ChangeLog: * trans-openmp.cc (gfc_trans_omp_depobj): Fix to alloc/ptr dummy and for c_ptr. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/depend-4.f90: Add VALUE test, update scan test. * gfortran.dg/gomp/depend-5.f90: Fix scan tree for -m32. * gfortran.dg/gomp/depend-6.f90: New test.
Diffstat (limited to 'gcc/fortran/trans-openmp.cc')
-rw-r--r--gcc/fortran/trans-openmp.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/fortran/trans-openmp.cc b/gcc/fortran/trans-openmp.cc
index e1c9d46..4d56a771 100644
--- a/gcc/fortran/trans-openmp.cc
+++ b/gcc/fortran/trans-openmp.cc
@@ -5536,9 +5536,12 @@ gfc_trans_omp_depobj (gfc_code *code)
gcc_assert (POINTER_TYPE_P (TREE_TYPE (var)));
}
else if ((n->sym->attr.allocatable || n->sym->attr.pointer)
- && n->sym->attr.optional)
+ && n->sym->attr.dummy)
var = build_fold_indirect_ref (var);
- else if (!POINTER_TYPE_P (TREE_TYPE (var)))
+ else if (!POINTER_TYPE_P (TREE_TYPE (var))
+ || (n->sym->ts.f90_type == BT_VOID
+ && !POINTER_TYPE_P (TREE_TYPE (TREE_TYPE (var)))
+ && !GFC_ARRAY_TYPE_P (TREE_TYPE (TREE_TYPE (var)))))
{
TREE_ADDRESSABLE (var) = 1;
var = gfc_build_addr_expr (NULL, var);