I have recently updated a legacy Fortran program to Fortran 90,
compiling it with Lahey LF95 v5.5. One subroutine in this program reads
in a data file using formatted read statements. The subroutine also
uses the iostat keyword in the read statement to distinguish between
valid records and other (non-data) records in the input file. Some of
the lines in the input file consist of a row of minus signs
("-------------------------") which are used to divide the various data
into tables and make the file easier to read (for a human).
I have found out (the hard way) that the Lahey-compiled program will
successfully read in the line of minus signs and assign the variables in
the input list to zero. I would have expected this behavior if the line
was blank; however, I was expecting the program to generate an error
when reading the line of minus signs (i.e. return a positive iostat
value). Additional testing has shown that the program will also treat a
line of plus signs ("++++++++++++") as zeroes in a formatted read.
Is this behavior standard conforming? I could not find anything in my
Fortran 90 programming book (Ellis, Philips, & Lahey). Evidently, the
previous version of this program, which was compiled with an older
compiler, did not treat the line of minus signs as zeroes.
Steve Rowles
Naval Surface Warfare Center
Dahlgren Virginia
|