Possible bug in Sun 4 FORTRAN I/O system

revans at voodoo.ucsb.edu revans at voodoo.ucsb.edu
Wed Feb 28 07:41:08 AEST 1990


Yesterday, I posted a request for help with an obscure problem I've been
having in this area.  As yet, I've had no response, but I have managed to
localise the problem to an interaction between the FORTRAN I/O system and
the system() subroutine.  The following program exhibits the problem.  I
have been told that the compiler is not the latest release, by the way.

Is this a known problem?   Has Sun released a fix?  Or is it a 'feature'?

c     buggy.f   Russ Evans 27-Feb-90

c     demonstrates problem of interaction between the FORTRAN I/O
c     rt-system and the 'system' call on Sun 4/280.  As yet untested
c     in other environments.  An erroneous EOF is found on the input 
c     unit following the call to system.  Contents of infile.dat and 
c     of the argument to system appear to be immaterial.  Behaviour
c     does not depend on choice of unit 10 for file input.

      character record*80
      character infile*15
      parameter (infile = 'infile.dat')
      integer   i,system

      open(unit=10, file=infile, status='OLD', err=901) 

   10 read(unit=10, fmt='(A)', err=902, end=903) record
      write(unit=6, fmt='(A)') record
      i=system('lpr junk')
      goto 10

  901 write(unit=6, fmt='(2A)') 'Failed to open ', infile
      stop 
  902 stop 'Read error on unit 10'
  903 stop 'End of file on unit 10'

      end


Russ Evans, British Geological Survey, Edinburgh UK  e_gs18 at va.nmh.ac.uk
 .. just visiting (and working hard) at UCSB ..



More information about the Comp.sys.sun mailing list