aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/openmp.c
diff options
context:
space:
mode:
authorDaniel Franke <franke.daniel@gmail.com>2007-06-27 16:02:31 -0400
committerDaniel Franke <dfranke@gcc.gnu.org>2007-06-27 16:02:31 -0400
commit24189c587c23578bcbe2e7395fef5afb75ee5184 (patch)
tree889fbe57e5950c52b3f6b693251d8b0c83bd518c /gcc/fortran/openmp.c
parent20de4d9913045c25b7cbc9d604cb251198f0197a (diff)
downloadgcc-24189c587c23578bcbe2e7395fef5afb75ee5184.zip
gcc-24189c587c23578bcbe2e7395fef5afb75ee5184.tar.gz
gcc-24189c587c23578bcbe2e7395fef5afb75ee5184.tar.bz2
re PR fortran/32467 (structure containing allocatable array is accepted in COPYIN clause)
gcc/fortran: 2007-06-24 Daniel Franke <franke.daniel@gmail.com> PR fortran/32467 * openmp.c (resolve_omp_clauses): Emit error on allocatable components in COPYIN, COPYPRIVATE, FIRSTPRIVATE and LASTPRIVATE clauses. gcc/testsuite: 2007-06-24 Daniel Franke <franke.daniel@gmail.com> PR fortran/32467 * gfortran.dg/gomp/allocatable_components_1.f90: New test. From-SVN: r126063
Diffstat (limited to 'gcc/fortran/openmp.c')
-rw-r--r--gcc/fortran/openmp.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c
index 9c5c033..54981ef 100644
--- a/gcc/fortran/openmp.c
+++ b/gcc/fortran/openmp.c
@@ -779,6 +779,9 @@ resolve_omp_clauses (gfc_code *code)
if (n->sym->attr.allocatable)
gfc_error ("COPYIN clause object '%s' is ALLOCATABLE at %L",
n->sym->name, &code->loc);
+ if (n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp)
+ gfc_error ("COPYIN clause object '%s' at %L has ALLOCATABLE components",
+ n->sym->name, &code->loc);
}
break;
case OMP_LIST_COPYPRIVATE:
@@ -790,6 +793,9 @@ resolve_omp_clauses (gfc_code *code)
if (n->sym->attr.allocatable)
gfc_error ("COPYPRIVATE clause object '%s' is ALLOCATABLE "
"at %L", n->sym->name, &code->loc);
+ if (n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp)
+ gfc_error ("COPYPRIVATE clause object '%s' at %L has ALLOCATABLE components",
+ n->sym->name, &code->loc);
}
break;
case OMP_LIST_SHARED:
@@ -820,6 +826,11 @@ resolve_omp_clauses (gfc_code *code)
if (n->sym->attr.allocatable)
gfc_error ("%s clause object '%s' is ALLOCATABLE at %L",
name, n->sym->name, &code->loc);
+ /* Variables in REDUCTION-clauses must be of intrinsic type (flagged below). */
+ if ((list < OMP_LIST_REDUCTION_FIRST || list > OMP_LIST_REDUCTION_LAST) &&
+ n->sym->ts.type == BT_DERIVED && n->sym->ts.derived->attr.alloc_comp)
+ gfc_error ("%s clause object '%s' has ALLOCATABLE components at %L",
+ name, n->sym->name, &code->loc);
if (n->sym->attr.cray_pointer)
gfc_error ("Cray pointer '%s' in %s clause at %L",
n->sym->name, name, &code->loc);
@@ -839,11 +850,11 @@ resolve_omp_clauses (gfc_code *code)
case OMP_LIST_MULT:
case OMP_LIST_SUB:
if (!gfc_numeric_ts (&n->sym->ts))
- gfc_error ("%c REDUCTION variable '%s' is %s at %L",
+ gfc_error ("%c REDUCTION variable '%s' at %L must be of intrinsic type, got %s",
list == OMP_LIST_PLUS ? '+'
: list == OMP_LIST_MULT ? '*' : '-',
- n->sym->name, gfc_typename (&n->sym->ts),
- &code->loc);
+ n->sym->name, &code->loc,
+ gfc_typename (&n->sym->ts));
break;
case OMP_LIST_AND:
case OMP_LIST_OR: