For the following program compiled and run on Windows XP
program xrecl
implicit none
integer , parameter :: in_unit=20,out_unit=21
character (len=*), parameter :: in_file="xrecl.dat"
integer :: jrecl
open (unit=out_unit,file=in_file,action="write",status="replace")
write (out_unit,*) "24"
close (out_unit)
do jrecl = 4,1,-1 ! 5,1,-1
call open_sub(jrecl)
end do
contains
subroutine open_sub(irecl)
integer, intent(in) :: irecl
integer :: i
write (*,"(/,' irecl =',i10)") irecl
open (unit=in_unit,file=in_file,action="read",status="old",recl=irecl)
read (in_unit,*) i
write (*,*) "i=",i
close (in_unit)
end subroutine open_sub
end program xrecl
mingw g95 Jun 25 2006 gives
irecl = 4
At line 18 of file xxrecl.f90 (Unit 20 "xrecl.dat")
Traceback: not available, compile with -ftrace=frame or -ftrace=full
Fortran runtime error: Reading more data than the record size (RECL)
and mingw gfortran May 31 2006 gives
irecl = 4
i= 24
irecl = 3
i= 24
irecl = 2
i= 24
irecl = 1
i= 24
For both compilers, the first line in file xrecl.dat contains a space
followed by "24" (no quotes in file), followed by a newline.
Re: aliased intent(in out) arguments ... the code is not standard-conforming.... What is non-conforming is for the subroutine in question to then modify ... One could also easily write a case where array elements were being ...Compilers *MAY* catch errors like this. ... (comp.lang.fortran)
Re: question about negative indices in fortran 77 ... | I am working with an "inherited" program written in Fortran 77. ... | Intel compilers for linux), but now I'm doing some modifications and I ... | I'm checking for violations of array bounds because the program is doing ... | subroutine where it isn't touched. ... (comp.lang.fortran)
Re: Was this a bug ... of 7 and then used this, in case the called subroutine treats the ... Are there actually any compilers in existence that honor the INTENT clause _and_ have the obnoxious bug of allowing numeric constants to get changed by this sort of error? ... I had thought that this was true even back in the days when "modern compiler" meant "implements Fortran 77 rather than an earlier version of the standard", but there may be a few long-obsolete exceptions.... In any case, at this point any compilers that are exceptions to that statement can be considered unacceptably buggy -- and if you're trying to write defensive code that will work even on unacceptably buggy compilers, there are far better places to start. ... (comp.lang.fortran)
question about negative indices in fortran 77 ...Intel compilers for linux), but now I'm doing some modifications and I ... I'm checking for violations of array bounds because the program is doing ...subroutine where it isn't touched. ... (comp.lang.fortran)
Re: Pass by reference or by value? ...subroutine bar ... It is common to pass constants and expressions to Fortran procedures,... You can pass a reference to a constant just as easily as you can pass a reference to a variable. ... Some early Fortran compilers omitted this small but important detail, leading to programs with incomprehensible semantics, as the values of numeric literals could no longer be relied upon. ... (comp.lang.python)