This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

format bug


    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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]