aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran/resolve.c
diff options
context:
space:
mode:
authorTobias Burnus <burnus@net-b.de>2012-01-27 14:02:54 +0100
committerTobias Burnus <burnus@gcc.gnu.org>2012-01-27 14:02:54 +0100
commit9775a921e0fb21cdd92ba3c26e603661865a5899 (patch)
treec8076a388aa6ee87935d6bb837f822203c931edf /gcc/fortran/resolve.c
parent45c8342998c3c431a06366f37c48be9082de8906 (diff)
downloadgcc-9775a921e0fb21cdd92ba3c26e603661865a5899.zip
gcc-9775a921e0fb21cdd92ba3c26e603661865a5899.tar.gz
gcc-9775a921e0fb21cdd92ba3c26e603661865a5899.tar.bz2
re PR fortran/52016 ([OOP] Polymorphism and elemental: missing diagnostic)
2012-01-27 Tobias Burnus <burnus@net-b.de> PR fortran/52016 * resolve.c (resolve_formal_arglist): Fix elemental constraint checks for polymorphic dummies. 2012-01-27 Tobias Burnus <burnus@net-b.de> PR fortran/52016 * gfortran.dg/elemental_args_check_5.f90: New. From-SVN: r183620
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r--gcc/fortran/resolve.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index b24399d..9bd5c00 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -374,21 +374,26 @@ resolve_formal_arglist (gfc_symbol *proc)
if (gfc_elemental (proc))
{
/* F08:C1289. */
- if (sym->attr.codimension)
+ if (sym->attr.codimension
+ || (sym->ts.type == BT_CLASS && CLASS_DATA (sym)
+ && CLASS_DATA (sym)->attr.codimension))
{
gfc_error ("Coarray dummy argument '%s' at %L to elemental "
"procedure", sym->name, &sym->declared_at);
continue;
}
- if (sym->as != NULL)
+ if (sym->as || (sym->ts.type == BT_CLASS && CLASS_DATA (sym)
+ && CLASS_DATA (sym)->as))
{
gfc_error ("Argument '%s' of elemental procedure at %L must "
"be scalar", sym->name, &sym->declared_at);
continue;
}
- if (sym->attr.allocatable)
+ if (sym->attr.allocatable
+ || (sym->ts.type == BT_CLASS && CLASS_DATA (sym)
+ && CLASS_DATA (sym)->attr.allocatable))
{
gfc_error ("Argument '%s' of elemental procedure at %L cannot "
"have the ALLOCATABLE attribute", sym->name,
@@ -1575,6 +1580,16 @@ resolve_procedure_expression (gfc_expr* expr)
}
+gfc_array_spec *
+symbol_as (gfc_symbol *sym)
+{
+ if (sym->ts.type == BT_CLASS && sym->attr.class_ok)
+ return CLASS_DATA (sym)->as;
+ else
+ return sym->as;
+}
+
+
/* Resolve an actual argument list. Most of the time, this is just
resolving the expressions in the list.
The exception is that we sometimes have to decide whether arguments