END of file test in F77 under SUN OS 4 (B

Lars Andersson larsa at nada.kth.se
Sat May 6 12:14:59 AEST 1989


The typescript included below exhibits an example of what I personally
consider to be nonstandard f77 behaviour. I would call it a bug, but this
is so simple and basic stuff that I can't see how it could leak through
even the most elementary test. 

The point is that the fortran program exhibited below shows different
behaviour under SUN OS 3.5 with the old f77 and under SUN OS 4.0.1 with
the new unbundled f77 compiler (this holds both for sparc and SUN 3
machines). Under 3.5 it behaves in the way that would be expected: the END
test causes normal completion.

This has been run under 3.5 and under SUN OS 4.0.1 with version 1.1 of f77
(according to /usr/lib/lang_info, I don't know the proper way to find out
about the f77 version).

The typescript follows: (spirit is a SUN 4 machine)

Script started on Mon Apr 17 21:52:48 1989
spirit>cat tst.f
      program test
      integer j
      real vektor(10)
100   continue
c         read(*,*,end=900,iostat=ierr,err=800)(vektor(j),j=1,3)
          read(*,*,end=900)(vektor(j),J=1,3)
          write(*,*)'row = ',(vektor(j),J=1,3)
      goto 100
      goto 1000
800   continue
      write(*,*)'error in tst, IERR = ',IERR
      goto 1000
900   CONTINUE
      WRITE(*,*)'tst finished OK'
1000  continue
      END
spirit>f77 -o tst tst.f
tst.f:
 MAIN test:
"tst.f", line 9: Warning: statement cannot be reached
spirit>cat tstin
10.0 20.0 30.0
10.0 20.0 30.0
10.0 20.0 30.0
10.0 20.0 30.0
10.0 20.0 30.0
1.0 2.0 3.0
spirit>cat tstin | tst
row =    10.00000    20.0000    30.0000
row =    10.00000    20.0000    30.0000
row =    10.00000    20.0000    30.0000
row =    10.00000    20.0000    30.0000
row =    10.00000    20.0000    30.0000
row =     1.00000    2.00000    3.00000
list io: [112] incomprehensible list input
logical unit 5, named 'stdin'
lately: reading sequential list external IO
part of last format: ext list io
part of last data: ^?^?^?^?^?^?^?^?^?^?^?^?|
IOT trap
spirit>exit

script done on Mon Apr 17 21:54:07 1989


I would be very grateful for comments on this example, since I need to
solve this to be able to port a large package without doing a lot of mods.

Lars Andersson
Dept. of Math, 
Royal Inst. of Technology
Stockholm



More information about the Comp.sys.sun mailing list