This is from NIST FM 517, a slightly reduced test case.
$ cat altreturn.f
subroutine first(i)
entry second(j, *)
return (j)
end
$ g77 -c altreturn.f
$ gfortran -c altreturn.f
altreturn.f: In function 'first':
altreturn.f:1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
$ gfortran -v
Reading specs from /home/ig25/lib/gcc/i686-pc-linux-gnu/4.0.0/specs
Configured with: ../gcc/configure --prefix=/home/ig25
--enable-languages=c,c++,f95 --disable-shared
Thread model: posix
gcc version 4.0.0 20041204 (experimental)
Backtrace:
$ gdb ~/libexec/gcc/i686-pc-linux-gnu/4.0.0/f951
GNU gdb 6.3-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-linux"...Using host libthread_db library
"/lib/tls/libthread_db.so.1".
(gdb) r altreturn.f
Starting program: /home/ig25/libexec/gcc/i686-pc-linux-gnu/4.0.0/f951
altreturn.f
first
Program received signal SIGSEGV, Segmentation fault.
0x080a2121 in gfc_create_function_decl (ns=0x86017c0)
at ../../gcc/gcc/fortran/trans-decl.c:1385
1385 if (formal->sym->ts.type == BT_CHARACTER)
(gdb) bt
#0 0x080a2121 in gfc_create_function_decl (ns=0x86017c0)
at ../../gcc/gcc/fortran/trans-decl.c:1385
#1 0x080a3b87 in gfc_generate_function_code (ns=0x86017c0)
at ../../gcc/gcc/fortran/trans-decl.c:2171
#2 0x08094b2a in gfc_generate_code (ns=0x86017c0)
at ../../gcc/gcc/fortran/trans.c:679
#3 0x0807b621 in gfc_parse_file () at ../../gcc/gcc/fortran/parse.c:2628
#4 0x08091c45 in gfc_be_parse_file (set_yydebug=0)
at ../../gcc/gcc/fortran/f95-lang.c:266
#5 0x083a7485 in toplev_main (argc=0, argv=0xbffff6a4)
at ../../gcc/gcc/toplev.c:992
#6 0x400757f8 in __libc_start_main () from /lib/tls/libc.so.6
#7 0x0804ad61 in _start () at ../sysdeps/i386/elf/start.S:102
(gdb)
--
Summary: [g77 regression] ENTRY with alternate return causes
compiler segfault
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: Thomas dot Koenig at online dot de
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18824