$ 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.)
Is this really a bug, changing the subroutine to: subroutine bar() character(len=10) :: str write (str, *) 0 end subroutine bar Also cause the problem, if I increase the size by a couple, it works.
(In reply to comment #1) > Is this really a bug, changing the subroutine to: > subroutine bar() > character(len=10) :: str > write (str, *) 0 > end subroutine bar > > Also cause the problem, if I increase the size by a couple, it works. > I think you are right. Closing as "INVALID".