diff options
Diffstat (limited to 'gcc/fortran/resolve.c')
-rw-r--r-- | gcc/fortran/resolve.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 1cc3165..4104054 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -601,9 +601,10 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns) } } - /* Fortran 95 Draft Standard, page 51, Section 5.1.1.5, on the Character + /* Fortran 2003 Draft Standard, page 535, C418, on type-param-value type, lists the only ways a character length value of * can be used: - dummy arguments of procedures, named constants, and function results + dummy arguments of procedures, named constants, function results and + in allocate statements if the allocate_object is an assumed length dummy in external functions. Internal function results and results of module procedures are not on this list, ergo, not permitted. */ @@ -3103,7 +3104,7 @@ resolve_function (gfc_expr *expr) return false; } - /* If this ia a deferred TBP with an abstract interface (which may + /* If this is a deferred TBP with an abstract interface (which may of course be referenced), expr->value.function.esym will be set. */ if (sym && sym->attr.abstract && !expr->value.function.esym) { @@ -3112,6 +3113,17 @@ resolve_function (gfc_expr *expr) return false; } + /* If this is a deferred TBP with an abstract interface, its result + cannot be an assumed length character (F2003: C418). */ + if (sym && sym->attr.abstract && sym->attr.function + && sym->result->ts.u.cl->length == NULL) + { + gfc_error ("ABSTRACT INTERFACE %qs at %L must not have an assumed " + "character length result (F2003: C418)", sym->name, + &sym->declared_at); + return false; + } + /* Switch off assumed size checking and do this again for certain kinds of procedure, once the procedure itself is resolved. */ need_full_assumed_size++; |