aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorJulian Brown <julian@codesourcery.com>2021-01-21 06:54:54 -0800
committerJulian Brown <julian@codesourcery.com>2021-02-17 06:13:55 -0800
commitd28f3da11d8c0aed9b746689d723022a9b5ec04c (patch)
treebe418cc1b24ed10a5a1c516f2a2368cbcff5bae7 /gcc/gimplify.c
parent7768cadb4246117964a9ba159740da3b9c20811d (diff)
downloadgcc-d28f3da11d8c0aed9b746689d723022a9b5ec04c.zip
gcc-d28f3da11d8c0aed9b746689d723022a9b5ec04c.tar.gz
gcc-d28f3da11d8c0aed9b746689d723022a9b5ec04c.tar.bz2
openacc: Fix lowering for derived-type mappings through array elements
This patch fixes lowering of derived-type mappings which select elements of arrays of derived types, and similar. These would previously lead to ICEs. With this change, OpenACC directives can pass through constructs that are no longer recognized by the gimplifier, hence alterations are needed there also. gcc/fortran/ * trans-openmp.c (gfc_trans_omp_clauses): Handle element selection for arrays of derived types. gcc/ * gimplify.c (gimplify_scan_omp_clauses): Handle ATTACH_DETACH for non-decls. gcc/testsuite/ * gfortran.dg/goacc/array-with-dt-1.f90: New test. * gfortran.dg/goacc/array-with-dt-3.f90: Likewise. * gfortran.dg/goacc/array-with-dt-4.f90: Likewise. * gfortran.dg/goacc/array-with-dt-5.f90: Likewise. * gfortran.dg/goacc/derived-chartypes-1.f90: Re-enable test. * gfortran.dg/goacc/derived-chartypes-2.f90: Likewise. * gfortran.dg/goacc/derived-classtypes-1.f95: Uncomment previously-broken directives. libgomp/ * testsuite/libgomp.oacc-fortran/derivedtypes-arrays-1.f90: New test. * testsuite/libgomp.oacc-fortran/update-dt-array.f90: Likewise.
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index d28fa19..caf25cc 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -9413,6 +9413,18 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p,
}
}
}
+ else if ((code == OACC_ENTER_DATA
+ || code == OACC_EXIT_DATA
+ || code == OACC_DATA
+ || code == OACC_PARALLEL
+ || code == OACC_KERNELS
+ || code == OACC_SERIAL)
+ && OMP_CLAUSE_MAP_KIND (c) == GOMP_MAP_ATTACH_DETACH)
+ {
+ gomp_map_kind k = (code == OACC_EXIT_DATA
+ ? GOMP_MAP_DETACH : GOMP_MAP_ATTACH);
+ OMP_CLAUSE_SET_MAP_KIND (c, k);
+ }
if (gimplify_expr (pd, pre_p, NULL, is_gimple_lvalue, fb_lvalue)
== GS_ERROR)