From cb79606d4958a3f3df1adfcc00b641e3b8089819 Mon Sep 17 00:00:00 2001 From: burnus Date: Thu, 28 Apr 2011 18:43:16 +0000 Subject: [PATCH 193/200] 2011-04-28 Tobias Burnus PR fortran/48788 * resolve.c (resolve_global_procedure): Error recovery - avoid segfault for (non)character-returning functions. 2011-04-28 Tobias Burnus PR fortran/48788 * gfortran.dg/whole_file_34.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_6-branch@173126 138bc75d-0d04-0410-961f-82ee72b054a4 index 1fef22b..75e4697 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -2187,7 +2187,7 @@ resolve_global_procedure (gfc_symbol *sym, locus *where, /* 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; new file mode 100644 index 0000000..9b421e0 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/whole_file_34.f90 @@ -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.7.0.4