$ cat bug.f90 module foo
implicit none integer :: strlength = 20 contains subroutine bar() character(len=strlength) :: str write (str, *) 0 end subroutine bar end module foo program test_foo use foo implicit none strlength = 10 call bar() end program test_foo $ gfortran bug.f90 $ a.out At line 10 of file bug.f90 Fortran runtime error: End of record I see this behaviour with both 4.1 and mainline. (With 4.0 I get a segmentation fault at runtime instead.) -- Summary: Runtime error on write to string of global variable length Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: eedelman at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25628