aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2020-06-18 15:27:30 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:14:01 -0300
commit2ebee457973112e7fdf515f87f6a7ed38b75af1e (patch)
treecaaa54d2fd6850c60de1ba6f0abed0debd01cd3a
parent8dcdfcbeb6a78782097096cad84ca2318ff02675 (diff)
downloadgcc-2ebee457973112e7fdf515f87f6a7ed38b75af1e.zip
gcc-2ebee457973112e7fdf515f87f6a7ed38b75af1e.tar.gz
gcc-2ebee457973112e7fdf515f87f6a7ed38b75af1e.tar.bz2
OpenMP/Fortran: Reject allocatable components in map clause
gcc/fortran/ChangeLog: * openmp.c (resolve_omp_clauses): Reject vars with allocatable components in OpenMP map clauses. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/map-alloc-comp-1.f90: New test.
-rw-r--r--gcc/fortran/openmp.c7
-rw-r--r--gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f9014
2 files changed, 21 insertions, 0 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 94522d1..e681903 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -4636,6 +4636,13 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
&& n->sym->as->type == AS_ASSUMED_SIZE)
gfc_error ("Assumed size array %qs in %s clause at %L",
n->sym->name, name, &n->where);
+ if (!openacc
+ && list == OMP_LIST_MAP
+ && n->sym->ts.type == BT_DERIVED
+ && n->sym->ts.u.derived->attr.alloc_comp)
+ gfc_error ("List item %qs with allocatable components is not "
+ "permitted in map clause at %L", n->sym->name,
+ &n->where);
if (list == OMP_LIST_MAP && !openacc)
switch (code->op)
{
diff --git a/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90 b/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90
new file mode 100644
index 0000000..0c44296
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/gomp/map-alloc-comp-1.f90
@@ -0,0 +1,14 @@
+!
+! ALLOCATABLE COMPONENTS:
+! - OpenMP 5: Permitted (and automatically recursively mapped)
+! -> Not yet supported.
+! - OpenMP 4.5: Not permitted.
+!
+implicit none (type, external)
+type sct
+ integer, allocatable :: c
+end type
+type(sct) var
+
+!$omp target enter data map(to:var) ! { dg-error "allocatable components is not permitted in map clause" }
+end