From: Tobias Burnus Date: Wed, 27 Apr 2011 20:32:21 +0000 (+0200) Subject: re PR fortran/48788 (ICE: SIGSEGV in resolve_global_procedure (resolve.c:2190) on... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fa9f7c70400c3ca2172f95bb297b9eb62e437853;p=gcc.git re PR fortran/48788 (ICE: SIGSEGV in resolve_global_procedure (resolve.c:2190) on invalid (?) fortran code) 2011-04-27 Tobias Burnus PR fortran/48788 * resolve.c (resolve_global_procedure): Error recovery - avoid segfault for (non)character-returning functions. 2011-04-27 Tobias Burnus PR fortran/48788 * gfortran.dg/whole_file_34.f90: New. From-SVN: r173048 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 78d687dbeed..46df31889d7 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2011-04-27 Tobias Burnus + + PR fortran/48788 + * resolve.c (resolve_global_procedure): Error recovery - + avoid segfault for (non)character-returning functions. + 2011-04-26 Thomas Koenig * decl.c (gfc_match_end): Check that the block name starts diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index d7b95f51e17..144d3086650 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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a99f1c423ba..d61af1b2568 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-04-27 Tobias Burnus + + PR fortran/48788 + * gfortran.dg/whole_file_34.f90: New. + 2011-04-27 Jan Hubicka * gcc.dg/tree-ssa/inline-9.c: New testcase. diff --git a/gcc/testsuite/gfortran.dg/whole_file_34.f90 b/gcc/testsuite/gfortran.dg/whole_file_34.f90 new file mode 100644 index 00000000000..9b421e004ae --- /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