[net.bugs.usg] libI77 bug

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (01/18/85)

There is a bug in the F77 I/O library on UNIX System V Release 2.0
(probably also under other versions of the f77 system).

The bug manifests itself as a spurious "err=" exception from a
formatted read from an internal string.  This turns out to be due
to a missing "return 0;" at the end of the z_rnew() function in
source file iio.c.  "lint" does not detect this since the function
is invoked indirectly via a pointer; alas, the strict type-checking
is relaxed for functions that are IMPLICITLY declared result type
(int), for backward compatibility with the days before (void).

The following test program tickles the bug:

      program main
      character arg*11
      arg='100'
      print 400,arg
      read(arg,100,err=4) ll
      print 300,ll
      stop
    4 print 200,arg,ll
      stop 'at err=4'
  100 format(i6)
  200 format(' error, arg=',a,' ll=',i6)
  300 format(' ok, ll=',i6)
  400 format(' start test,arg=',a)
      end

(Actually, the above program ran okay on a PDP-11 but that was just
an accident.  It broke on a VAX.)