===================================================================
@@ -0,0 +1,12 @@
+! { dg-do compile }
+!
+! PR fortran/48788
+!
+! Contributed by Zdenek Sojka
+!
+function foo ()
+end function foo
+ character(4), external :: foo ! { dg-error "Return type mismatch of function" }
+ character(4) :: x
+ x = foo ()
+END
===================================================================
@@ -1,3 +1,8 @@
+2011-04-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/48788
+ * gfortran.dg/whole_file_34.f90: New.
+
2011-04-27 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-ssa/inline-9.c: New testcase.
===================================================================
@@ -1,3 +1,9 @@
+2011-04-27 Tobias Burnus <burnus@net-b.de>
+
+ PR fortran/48788
+ * resolve.c (resolve_global_procedure): Error recovery -
+ avoid segfault for (non)character-returning functions.
+
2011-04-26 Thomas Koenig <tkoenig@gcc.gnu.org>
* decl.c (gfc_match_end): Check that the block name starts
===================================================================
@@ -2187,7 +2187,7 @@
/* F2003, 12.3.1.1 (3c); F2008, 12.4.2.2 (3c) */
if (sym->ts.type == BT_CHARACTER && sym->attr.if_source != IFSRC_IFBODY
- && def_sym->ts.u.cl->length != NULL)
+ && def_sym->ts.type == BT_CHARACTER && def_sym->ts.u.cl->length != NULL)
{
gfc_charlen *cl = sym->ts.u.cl;