From b95605fb0c2052fcd1c2239acaa58748c9efc687 Mon Sep 17 00:00:00 2001 From: Paul Thomas Date: Mon, 21 Nov 2005 16:05:58 +0000 Subject: re PR fortran/24223 (Gfortran crashes in two places) 2005-11-21 Paul Thomas PR fortran/24223 * resolve.c (resolve_contained_fntype) Error if an internal function is assumed character length. PR fortran/24705 * trans-decl.c (gfc_create_module_variable) Skip ICE in when backend decl has been built and the symbol is marked as being in an equivalence statement. 2005-11-21 Paul Thomas + + PR fortran/24223 + * resolve.c (resolve_contained_fntype) Error if an internal + function is assumed character length. + + PR fortran/24705 + * trans-decl.c (gfc_create_module_variable) Skip ICE in + when backend decl has been built and the symbol is marked + as being in an equivalence statement. + 2005-11-20 Toon Moene * invoke.texi: Remove superfluous @item. diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 0f17585..cb9c65b 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -294,6 +294,19 @@ resolve_contained_fntype (gfc_symbol * sym, gfc_namespace * ns) sym->attr.untyped = 1; } } + + /*Fortran 95 Draft Standard, page 51, Section 5.1.1.5, on the Character type, + lists the only ways a character length value of * can be used: dummy arguments + of proceedures, named constants, and function results in external functions. + Internal function results are not on that list; ergo, not permitted. */ + + if (sym->ts.type == BT_CHARACTER) + { + gfc_charlen *cl = sym->ts.cl; + if (!cl || !cl->length) + gfc_error ("Character-valued internal function '%s' at %L must " + "not be assumed length", sym->name, &sym->declared_at); + } } diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 04f037b..37e9db8 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -2366,7 +2366,8 @@ gfc_create_module_variable (gfc_symbol * sym) return; /* Equivalenced variables arrive here after creation. */ - if (sym->backend_decl && sym->equiv_built) + if (sym->backend_decl + && (sym->equiv_built || sym->attr.in_equivalence)) return; if (sym->backend_decl) -- cgit v1.1