format bug
Jack Howarth
howarth@bromo.msbb.uc.edu
Tue Jul 26 01:55:00 GMT 2005
I have reported this bug to the g95 developer and he is working on
a fix for his compiler. The gfortran compiler suffers from the same
flaw. If you compile the following....
PROGRAM FORMATBUG
CHARACTER*1 CHAIN
INTEGER SRESID, IMAIN
CHARACTER*5 SEQNO
CHARACTER*3 RNAME
REAL VALUE
SRESID=1
CHAIN="A"
SEQNO=" 2"
RNAME="ASP"
IMAIN=8
VALUE=1.2311
180 FORMAT(I6,A1,A5,A3,I2,F9.4,2(1X,A1,A5,A3))
WRITE(6,180) SRESID, CHAIN,
- SEQNO, RNAME, IMAIN,
- VALUE
END
as follows...
g77 formatbug.c
./a.out > g77.out
gfortran formatbug.c
./a.out > gfortran.out
diff -uNr g77.out gfortran.out
...you will see...
--- g77.out 2005-07-23 23:18:37.000000000 -0400
+++ gfortran.out 2005-07-23 23:19:21.000000000 -0400
@@ -1 +1 @@
- 1A 2ASP 8 1.2311
+ 1A 2ASP 8 1.2311
This is because both g95 and gfortran output an extra space at the
end of the line which shouldn't be there.
Jack
More information about the Fortran
mailing list