The following source, compiled with a recent 4.5 snapshot using -ggdb as the only compiler option:
MODULE x04aafe_aux IMPLICIT NONE CONTAINS SUBROUTINE dummy INTEGER :: nerr CALL x04aaf(0,nerr) PRINT *, 'Hello',nerr END SUBROUTINE dummy END MODULE x04aafe_aux PROGRAM x04aafe USE x04aafe_aux CALL x04aaf(1,666) CALL dummy END PROGRAM x04aafe SUBROUTINE X04AAF(IFLAG,NERR) INTEGER, INTENT (IN) :: IFLAG INTEGER, INTENT (INOUT) :: NERR INTEGER, SAVE :: NERR1 DATA NERR1/6/ IF (IFLAG==0) NERR = NERR1 IF (IFLAG==1) NERR1 = NERR END SUBROUTINE X04AAF gives, after entering gdb ./a.out and setting a break on the PRINT line in routine DUMMY (line number 7): Breakpoint 1, __x04aafe_aux_MOD_dummy () at x04aafe.f90:7 7 PRINT *, 'Hello',nerr Current language: auto; currently fortran (gdb) p nerr No symbol "nerr" in current context. -- Summary: Source with routine in CONTAINS section and a local variable: No symbol "nerr" in current context Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: toon at moene dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40998