$cat test.f90 program test real :: foo contains function foo () end function foo end program test Gfortran passes it. If add external attribute, we'll get ICE. $cat test2.f90 program test real, external :: foo contains function foo () end function foo end program test $gfortran test2.f90 test2.f90: In function ‘MAIN__â€? test2.f90:7: internal compiler error: in build_function_decl, at fortran/trans -decl.c:1063 Please submit a full bug report, with preprocessed source if appropriate. See for instructions. $gfortran -v Using built-in specs. Target: i686-pc-linux-gnu Configured with: ../gcc/configure --enable-languages=c,fortran --prefix=/home/wf /local : (reconfigured) ../gcc/configure --prefix=/home/wf/local --enable-langua ges=c,fortran --no-create --no-recursion : (reconfigured) ../gcc/configure --pre fix=/home/wf/local --enable-languages=c,fortran --no-create --no-recursion Thread model: posix gcc version 4.1.0 20051010 (experimental) -- Summary: Does not detect duplicate symbol names in contains block Product: gcc Version: 4.1.0 Status: UNCONFIRMED Keywords: ice-on-invalid-code, accepts-invalid Severity: normal Priority: P2 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: fengwang at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24327