aboutsummaryrefslogtreecommitdiff
path: root/gcc/fortran
diff options
context:
space:
mode:
authorDaniel Kraft <d@domob.eu>2009-10-07 20:13:28 +0200
committerDaniel Kraft <domob@gcc.gnu.org>2009-10-07 20:13:28 +0200
commit6c19d9b5b20707a26e1f2d36db109ae6c5acda30 (patch)
tree2eabbdad5d4418b24ddc047a78065e01a491572e /gcc/fortran
parent7ba06dee521e57b113041ef5131b42200f0936ec (diff)
downloadgcc-6c19d9b5b20707a26e1f2d36db109ae6c5acda30.zip
gcc-6c19d9b5b20707a26e1f2d36db109ae6c5acda30.tar.gz
gcc-6c19d9b5b20707a26e1f2d36db109ae6c5acda30.tar.bz2
re PR fortran/41615 (Bogus error message: "internal function" should be "module procedure")
2009-10-07 Daniel Kraft <d@domob.eu> PR fortran/41615 * resolve.c (resolve_contained_fntype): Clarify error message for invalid assumed-length character result on module procedures. 2009-10-07 Daniel Kraft <d@domob.eu> PR fortran/41615 * gfortran.dg/assumed_charlen_function_6.f90: New test. From-SVN: r152534
Diffstat (limited to 'gcc/fortran')
-rw-r--r--gcc/fortran/ChangeLog6
-rw-r--r--gcc/fortran/resolve.c19
2 files changed, 21 insertions, 4 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog
index 7b4ecc6..5035c1b 100644
--- a/gcc/fortran/ChangeLog
+++ b/gcc/fortran/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-07 Daniel Kraft <d@domob.eu>
+
+ PR fortran/41615
+ * resolve.c (resolve_contained_fntype): Clarify error message for
+ invalid assumed-length character result on module procedures.
+
2009-10-07 Janus Weil <janus@gcc.gnu.org>
* expr.c (gfc_check_pointer_assign): Do the correct type checking when
diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c
index 4092891..1aee540 100644
--- a/gcc/fortran/resolve.c
+++ b/gcc/fortran/resolve.c
@@ -367,15 +367,26 @@ resolve_contained_fntype (gfc_symbol *sym, gfc_namespace *ns)
/* 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 procedures, named constants, and function results
- in external functions. Internal function results are not on that list;
- ergo, not permitted. */
+ in external functions. Internal function results and results of module
+ procedures are not on this list, ergo, not permitted. */
if (sym->result->ts.type == BT_CHARACTER)
{
gfc_charlen *cl = sym->result->ts.u.cl;
if (!cl || !cl->length)
- gfc_error ("Character-valued internal function '%s' at %L must "
- "not be assumed length", sym->name, &sym->declared_at);
+ {
+ /* See if this is a module-procedure and adapt error message
+ accordingly. */
+ bool module_proc;
+ gcc_assert (ns->parent && ns->parent->proc_name);
+ module_proc = (ns->parent->proc_name->attr.flavor == FL_MODULE);
+
+ gfc_error ("Character-valued %s '%s' at %L must not be"
+ " assumed length",
+ module_proc ? _("module procedure")
+ : _("internal function"),
+ sym->name, &sym->declared_at);
+ }
}
}