Created attachment 24113 [details] reduced testcase Compiler output: $ gfortran testcase.f90 testcase.f90:3.31: character(4), external :: foo 1 Error: Return type mismatch of function 'foo' at (1) (CHARACTER(1)/REAL(4)) ==3307== Invalid read of size 8 ==3307== at 0x55C8D2: resolve_global_procedure (resolve.c:2190) ==3307== by 0x560A8D: gfc_resolve_expr (resolve.c:3005) ==3307== by 0x5684C9: resolve_code (resolve.c:9028) ==3307== by 0x56A84E: resolve_codes (resolve.c:13614) ==3307== by 0x55C32B: gfc_resolve (resolve.c:13641) ==3307== by 0x5522BA: gfc_parse_file (parse.c:4200) ==3307== by 0x58B175: gfc_be_parse_file (f95-lang.c:250) ==3307== by 0x95E2BB: toplev_main (toplev.c:579) ==3307== by 0x644AB6C: (below main) (in /lib64/libc-2.11.3.so) ==3307== Address 0x0 is not stack'd, malloc'd or (recently) free'd ==3307== f951: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Tested revisions: r172960 - crash 4.6 r172337 - crash 4.5 r172337 - code is accepted
2189 if (sym->ts.type == BT_CHARACTER && sym->attr.if_source != IFSRC_IFBODY 2190 && def_sym->ts.u.cl->length != NULL) As def_sym is not BT_CHARACTER, dereferencing def_sym->ts.u.cl fails ...
Author: burnus Date: Wed Apr 27 20:32:21 2011 New Revision: 173048 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173048 Log: 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-27 Tobias Burnus <burnus@net-b.de> PR fortran/48788 * gfortran.dg/whole_file_34.f90: New. Added: trunk/gcc/testsuite/gfortran.dg/whole_file_34.f90 Modified: trunk/gcc/fortran/ChangeLog trunk/gcc/fortran/resolve.c trunk/gcc/testsuite/ChangeLog
Author: burnus Date: Thu Apr 28 18:43:16 2011 New Revision: 173126 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=173126 Log: 2011-04-28 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-28 Tobias Burnus <burnus@net-b.de> PR fortran/48788 * gfortran.dg/whole_file_34.f90: New. Added: branches/gcc-4_6-branch/gcc/testsuite/gfortran.dg/whole_file_34.f90 Modified: branches/gcc-4_6-branch/gcc/fortran/ChangeLog branches/gcc-4_6-branch/gcc/fortran/resolve.c branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
FIXED on the trunk - and on the 4.6 branch. Thanks for the report!