Help Files: Fortran77: Error Messages





     HELP                      June 15, 1985            F77/ERROR_MSGS



                   Interpreting Execution Error Messages



     1. Types of Errors

     Execution error messages for Fortran programs  are  generated  by
     the  Fortran I/O library (error number = -1 or > 99), by the UNIX
     system routines ( 0 < error number < 99), and by the UNIX  signal
     handler (no error number printed).


     2. Fortran I/O Library Error Messages

     Here are examples of two common I/O errors; for a  complete  list
     of  the  Fortran  I/O  library  error  messages,  see  "help  f77
     io_err_msgs".  The first error results from trying to read beyond
     the end of a file:

             dofio: [-1] end of file
             logical unit 5, named 'stdin'
             lately: reading sequential formatted external I/O
             format: (i10)
             *** Execution terminated

     The first line names the system routine, dofio(), that issued the
     error  message,  gives  the error message number, -1, and a short
     description of the error.  The second line shows that  the  error
     involved  Fortran  logical  unit 5 and file 'stdin' (standard in-
     put).  The third line tells the type of I/O being attempted.

     The second example is a little more complex:

             dofio: [115] invalid data for integer format term
             logical unit 5, named 'stdin'
             lately: reading sequential formatted external I/O
             format: (i10)
             part of last data: 22|e8
             *** Execution terminated

     The program tried to read ``22e8'' with an  ``i5''  format  term.
     The  I/O  library  is  complaining that the letter ``e'' is not a
     valid input character when reading  integers.   There  is  a  new
     line,  listing  the data being read, which was not present in the
     previous error message.  A vertical bar, ``|'', is  put  next  to
     the  input  character  the formatting routines were scanning when
     the error was detected.  This line is only generated  when  doing
     I/O  with  disk  files.  In this example, the program was invoked
     by:

             a.out < data

     The program is reading a disk file via the redirection  of  stan-
     dard input.

     Any error detected during I/O processing will cause  the  program
     to  abort  unless  the I/O statement included an 'err=' clause to
     provide a branch on error or an 'iostat=' clause to save the  er-
     ror  code.  Read statements may include 'end=' to branch  on end-
     of-file.


     3. Signal Handler Error Messages

     Most arithmetic errors and other errors causing  hardware  inter-
     rupts  cause  a  signal to be sent to the process that caused the
     error.  If, as is typical with Fortran programs, the process  has
     not been set up to handle signals, then the process is terminated
     with an appropriate (although sometimes  mysterious)  error  mes-
     sage.   These error messages usually appear with no numbers; how-
     ever under certain circumstances, the error numbers may also  ap-
     pear.

     The most common of these messages are  reproduced  and  explained
     here:

             *** Arithmetic Exception: Floating point overflow
             *** Execution Terminated

     The program tried to generate a floating point number greater  in
     absolute value than approximately 1.7e+38.

             *** Arithmetic Exception: Integer divide by 0
             *** Execution Terminated

     The program divided by an integer zero;  this  is  mathematically
     undefined.

             *** Arithmetic Exception: Floating divide by zero
             *** Execution Terminated

     The program divided by a floating point zero; this is  mathemati-
     cally undefined.

             *** Arithmetic Exception: Integer overflow
             *** Execution Terminated

     The program tried to generate an integer outside the VAX's  range
     of  integers,  either  greater  than 2**31-1 (2147483647) or less
     than -2**31 (-2147483648).  This interrupt is  not  normally  en-
     abled;  to catch this error, you need to call subroutine traper()
     in each subprogram (see "man 3f traper").

             *** Arithmetic Exception: Floating point underflow
             *** Execution Terminated

     The program tried to generate a floating point number whose abso-
     lute  value  is less than 2.9e-39.  This trap is not normally en-
     abled; to enable it you must call  subroutine  traper()  in  each
     subprogram (see "man 3f traper").

             *** Segmentation violation
             *** Execution Terminated

     The program tried to reference beyond the current bounds  of  its
     memory.   This  is usually caused by using invalid subscripts for
     an array; recompiling and rerunning with  the  ``-C''  flag  will
     catch many of these errors.

             *** Bus error
             *** Execution Terminated

     The program has tried to store in a protected area  such  as  the
     code  for  the program.  This is often caused by using an invalid
     subscript when storing into an array; recompiling  and  rerunning
     with  the ``-C'' option will find many of these errors.  This may
     also be caused by calling a subprogram passing fewer actual argu-
     ments  than are declared and used in the subprogram.  It can also
     occur when a subroutine or function is passed as an argument to a
     subprogram  when  the subprogram is expecting a variable or array
     and the subprogram tries to store in the  argument.   Storing  on
     top of a constant, e.g.:

             call sub(0)
             ...
             subroutine sub(ival)
             ival = min0(ival,3000)

     also causes this error.

             *** Illegal instruction
             *** Execution Terminated

     This may mean that your program is overwriting itself.   This  is
     uncommon  because  the  program  code and variable storage are in
     different areas of memory and the program code is  normally  pro-
     tected.

             *** Illegal operand
             *** Execution Terminated

     An invalid floating point number (exponent value of 0, sign value
     of  1)  was  used  in  a  floating  point computation.  This is a
     reserved operand in the floating point logic of the VAX.   If  an
     integer  multiple of 32768 is used as a real, this interrupt will
     be generated.

     For a complete list of signals, see "man 2  sigvec"  or  "man  3c
     signal".

     The user can regain control after signal handler errors  via  the
     signal()  subroutine (see "man 3f signal").  Unfortunately, after
     regaining control, there is currently no way  to  resume  exactly
     where you left off.


     4. Errors due to unsuccessful system calls

     This type of message is less common than  the  other  two  types.
     Here are two examples.  The following messages result from trying
     to read from a file for which you do not have read permission:

             fort.1: [13] Permission denied
             logical unit 1, named 'fort.1'
             *** Execution Terminated

     and the following resulted when trying to read from unit 6, stan-
     dard output:

             read sfe: [9] Bad file number
             logical unit 6, named 'stdout'
             lately: reading sequential formatted external IO
             format: (i5)
             *** Execution Terminated

     Unfortunately, these errors are numbered using  the  same  number
     range  as the signal errors described above.  For example, an er-
     ror 24 could either be the system call error 24, too  many  files
     open, or signal message 24, cpu time limit exceeded.  The context
     usually makes it clear which type of error has occurred; also the
     signal messages normally appear without numbers.

             


Comments to decf@euler.berkeley.edu
© 1998 UC Regents