diff options
author | Paul Thomas <pault@gcc.gnu.org> | 2006-11-22 00:05:10 +0000 |
---|---|---|
committer | Paul Thomas <pault@gcc.gnu.org> | 2006-11-22 00:05:10 +0000 |
commit | 92c59193a16f4bf1731e62a07e0540171269c36e (patch) | |
tree | 7917653e404c26436bdce630f8d57f59116c5d61 /gcc/fortran | |
parent | 991f3b1289865f843d1724594f3dd57f4abf87ec (diff) | |
download | gcc-92c59193a16f4bf1731e62a07e0540171269c36e.zip gcc-92c59193a16f4bf1731e62a07e0540171269c36e.tar.gz gcc-92c59193a16f4bf1731e62a07e0540171269c36e.tar.bz2 |
re PR fortran/25087 (Error for missing explicit interface needed.)
2006-11-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25087
* resolve.c (resolve_fl_procedure): Add an error if an external
automatic character length function does not have an explicit
interface.
2006-11-22 Paul Thomas <pault@gcc.gnu.org>
PR fortran/25087
* gfortran.dg/auto_char_len_4.f90: New test.
From-SVN: r119077
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/fortran/resolve.c | 22 |
2 files changed, 21 insertions, 8 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index d758a48..b9c5944 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,12 @@ 2006-11-22 Paul Thomas <pault@gcc.gnu.org> + PR fortran/25087 + * resolve.c (resolve_fl_procedure): Add an error if an external + automatic character length function does not have an explicit + interface. + +2006-11-22 Paul Thomas <pault@gcc.gnu.org> + PR fortran/29652 * interface.c (check_interface1): Use a local value, instead of the dummy, as the inner iterator over interface symbols. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 5bd8296..e798070 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -89,8 +89,6 @@ resolve_formal_arglist (gfc_symbol * proc) gfc_symbol *sym; int i; - /* TODO: Procedures whose return character length parameter is not constant - or assumed must also have explicit interfaces. */ if (proc->result != NULL) sym = proc->result; else @@ -5529,17 +5527,25 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag) && resolve_fl_var_and_proc (sym, mp_flag) == FAILURE) return FAILURE; - if (sym->attr.proc == PROC_ST_FUNCTION) + if (sym->ts.type == BT_CHARACTER) { - if (sym->ts.type == BT_CHARACTER) - { - gfc_charlen *cl = sym->ts.cl; - if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT) - { + gfc_charlen *cl = sym->ts.cl; + if (!cl || !cl->length || cl->length->expr_type != EXPR_CONSTANT) + { + if (sym->attr.proc == PROC_ST_FUNCTION) + { gfc_error ("Character-valued statement function '%s' at %L must " "have constant length", sym->name, &sym->declared_at); return FAILURE; } + + if (sym->attr.external && sym->formal == NULL + && cl && cl->length && cl->length->expr_type != EXPR_CONSTANT) + { + gfc_error ("Automatic character length function '%s' at %L must " + "have an explicit interface", sym->name, &sym->declared_at); + return FAILURE; + } } } |