[comp.sys.ibm.pc.rt] Fortran runtime error handling

maine@elxsi.dfrf.nasa.gov (Richard Maine) (08/29/90)

I've run into some annoying "features" of the error handling in the
Fortran runtimes in AIX 3.1 for the IBM RS 6000 series.  Has anybody
else run into these?

For a sample of the worst, try the following trivial program.
Pardon the style; I wanted to keep the sample short.

      program testerr
      character c*7
      c = '1y3.4e5'
      read (c,'(f7.1)',iostat=ierr,err=100) x
      if (iostat.ne.0) write (*,*) 'iostat = ',iostat
      write (*,*) 'x = ',x
      stop
  100 write (*,*) 'Took err branch. iostat = ',iostat
      end

The above program gives a value of 1. for x.  There are no error
indications of any kind.  Nice, huh?

My reading of IBM's Fortran manual is that much of this behavior is
intentional; the runtimes are "supposed" to "fix up" errors for you
instead of reporting them with err= or iostat=, which are reserved for
"data transfer errors" instead of data content errors.  Perhaps it is
accidental that some cases don't print warning messages about the
fixup, but it appears intentional that neither err= or iostat= is used
to report the error.  Does anybody really think of these as "features"
instead of serious bugs, or do people like getting wrong answers?

I've not run into this behavior on any other Fortran 77 compiler/runtime,
including those for IBM PCs, various Unix systems, Vaxen, and others.

The following is a slightly edited excerpt from the document file of
the IBM RS6000 port of one of my programs.  It gives a little more
information, plus a possibly controversial recommendation.  I must
agree that this system seems like a screamer for speed; wish I could
trust the results.

Constructive comments welcome.  Nags to IBM to get them to fix it
even more welcome.

-----------------------------
BUGS

  The error handling in the ibm runtimes is horrid.  Specifically:

  Hitting an end of file causes an error message to be splatted all
  over the screen even if the program handles the condition with an
  iostat= specifier.  (An end= specifier seems to work as expected).
  Likewise, errors in opening a file cause error messages that cannot
  be disabled.  The program works correctly, except for the ugly
  error messages.

  A substantially worse problem is that programs will not take err=
  branches or set iostat variables on data errors such as illegal
  characters in numeric format fields.  The system has its own idea of
  corrective action, which you can't override.  It appears that for I
  format reads, the system splats error messages all over the screen,
  but does not inform the program of the problem.  For floatting point
  formatted reads, the system just garbages up the data, with no
  indication of any problem.

  Until the last problem above is fixed, I would be very reluctant
  to trust computations on this system.  There is too much chance
  of simple typographical errors causing undiagnosed garbage results.
-----------------------------
--

Richard Maine
maine@elxsi.dfrf.nasa.gov [130.134.64.6]

RAH@IBM.COM ("Russell A. Heise") (10/10/90)

 maine@elxsi.dfrf.nasa.gov (Richard Maine) writes:

 > I've run into some annoying "features" of the error handling in the
 > Fortran runtimes in AIX 3.1 for the IBM RS 6000 series.  Has anybody
 > else run into these?
 >
 > ... sample program ...
 >
 > My reading of IBM's Fortran manual is that much of this behavior is
 > intentional; the runtimes are "supposed" to "fix up" errors for you
 > instead of reporting them with err= or iostat=, which are reserved for
 > "data transfer errors" instead of data content errors.  Perhaps it is
 > accidental that some cases don't print warning messages about the
 > fixup, but it appears intentional that neither err= or iostat= is used
 > to report the error.  Does anybody really think of these as "features"
 > instead of serious bugs, or do people like getting wrong answers?

 No, this behavior is not good.  Development is working on fixing it and
 the changes will be included in a future update.  Contact your local IBM
 rep and have him/her report this as a problem.  That will insure that
 you get the changes.
 >
 > ...
 >
 >   Hitting an end of file causes an error message to be splatted all
 >   over the screen even if the program handles the condition with an
 >   iostat= specifier.  (An end= specifier seems to work as expected).
 >   Likewise, errors in opening a file cause error messages that cannot
 >   be disabled.  The program works correctly, except for the ugly
 >   error messages.

 Actually, you can control these messages.  Try the following command line:
   xrf_messages=no; export xrf_messages
 >
 > ...
 >
 >   Until the last problem above is fixed, I would be very reluctant
 >   to trust computations on this system.  There is too much chance
 >   of simple typographical errors causing undiagnosed garbage results.

Russ Heise, AIX Technical Support, IBM