Malcolm Cohen's talk to the BCS 50th anniversary of FORTRAN meeting has this example:
MODULE m REAL :: x(3) = (/ 1.5, 2.5, 3.5 /) CONTAINS SUBROUTINE s CALL inner CONTAINS SUBROUTINE inner PRINT *,x(7) ! This is not an error! END SUBROUTINE FUNCTION x(n) x = REAL(n)**n END FUNCTION END SUBROUTINE END MODULE use m call s() end to which, gfortran incorrectly returns PRINT *,x(7) ! This is not an error! 1 Warning: Array reference at (1) is out of bounds unless subroutine inner and function x are interchanged. Paul -- Summary: 50th Anniversary Bug - scoping error Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pault at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30746