aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-04-17 19:08:55 +0200
committerTobias Burnus <tobias@codesourcery.com>2020-04-17 19:08:55 +0200
commitaf557050fd011a03d21dc26b31959033061a0443 (patch)
treeab3da9c086828fce51a0e921179aa31a94e5ce62 /gcc/gimplify.c
parent875d6cb3b4919b58ae5e6313db715bc4dd3ddd6c (diff)
downloadgcc-af557050fd011a03d21dc26b31959033061a0443.zip
gcc-af557050fd011a03d21dc26b31959033061a0443.tar.gz
gcc-af557050fd011a03d21dc26b31959033061a0443.tar.bz2
[OpenMP] Fix 'omp exit data' for Fortran arrays (PR 94635)
PR middle-end/94635 * gimplify.c (gimplify_scan_omp_clauses): Turn MAP_TO_PSET to MAP_DELETE. PR middle-end/94635 * testsuite/libgomp.fortran/target-enter-data-2.F90: New.
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 8cdfae2..2f2c51b 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -8785,10 +8785,14 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
'exit data' - and in particular for 'delete:' - having an 'alloc:'
does not make sense. Likewise, for 'update' only transferring the
data itself is needed as the rest has been handled in previous
- directives. */
- if ((code == OMP_TARGET_EXIT_DATA || code == OMP_TARGET_UPDATE)
- && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
- || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET))
+ directives. However, for 'exit data', the array descriptor needs
+ to be delete; hence, we turn the MAP_TO_PSET into a MAP_DELETE. */
+ if (code == OMP_TARGET_EXIT_DATA
+ && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET)
+ OMP_CLAUSE_SET_MAP_KIND (c, GOMP_MAP_DELETE);
+ else if ((code == OMP_TARGET_EXIT_DATA || code == OMP_TARGET_UPDATE)
+ && (OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_POINTER
+ || OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_TO_PSET))
remove = true;
if (remove)