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]

RE: Incorrect treatment of separators in list directed read of REALs


Sorry, the zipped file of the test program below was identified as
executable content... *sigh*

test_list.f

      program test_list

C Test of gfortran list directed read> check delimiters are correctly
C treated.  Written in f77 so that g77 will run for comparison.
C
C PThomas                                                   Jan 2005

      integer i(10)
      character*80 A 
      real x(10)

      do j=1,10
        x(j)=0
        i(j)=0
      end do

      open(10)

C f , e and i editting are treated differently by read_real

      write(10,*) " 1.0, 2.0 , 3.0,, 2* , 2*4.0 , 5*99.0"
      write(10,*) " 1.0e0, 2.0e0 , 3.0e0,, 2* , 2*4.0e0 , 5*99.0e0"
      write(10,*) " 1,   2 ,   3,,   2* , 2*4 ,   5*99"
      write(10,*) " 1,   2 ,   3,,   2* , 2*4 ,   5*99"

      rewind(10)
      
      do j=1,4
        read(10,'(a80)') A
        write(*,*) A
      end do
      rewind(10)
      
      read(10,*,iostat=ier) x
      write(*,*) "reals with decimal point"
      write(*,'(1x , 10i6)') (nint(x(j)),j=1,10)
      do j=1,10
        x(j)=0
        i(j)=0
      end do
      
      READ(10,*,iostat=ier) x
      write(*,*) "reals with exponent"
      write(*,'(1x , 10i6)') (nint(x(j)),j=1,10)
      do j=1,10
        x(j)=0
        i(j)=0
      end do

      READ(10,*,iostat=ier) x
      write(*,*) "reals read as integers"
      write(*,'(1x , 10i6)') (nint(x(j)),j=1,10)
      
      READ(10,*,iostat=ier) (i(j),j=1,10)
      write(*,*) "integers"
      write(*,'(1x , 10i6)') (i(j),j=1,10)
      
      close(10)
      stop
      end 


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