Run-Time Library Default Error Processing

During execution, your program may encounter errors or exception conditions. These conditions can result from any of the following:

The Intel® Fortran Run-Time Library (RTL) generates appropriate messages and takes action to recover from errors whenever possible.

A default action is defined for each error recognized by the Fortran RTL. The default actions described throughout this chapter occur unless overridden by explicit error-processing methods.

The way in which the Fortran RTL actually processes errors depends upon the following factors:

How arithmetic exception conditions are reported and handled depends on the cause of the exception and how the program was compiled. Unless the program was compiled to handle exceptions, the exception might not be reported until after the instruction that caused the exception condition. The following compiler options are related to handling errors and exceptions:

Run-Time Message Format

When errors occur during execution (run time) of a program, the Fortran RTL issues diagnostic messages. These run-time messages have the following format:

forrtl: severity (nnn): message-text

where:

The severity levels are described in order of greatest to least severity:

For severe errors, stack trace information is produced by default, unless the environment variable FOR_DISABLE_STACK_TRACE is set. If the command-line option -traceback is set, the stack trace information contains program counters set to symbolic information. Otherwise, the information contains merely hexadecimal program counter information.

In some cases, stack trace information is also produced by the compiled code at run time to provide details about the creation of array temporaries.

If FOR_DISABLE_STACK_TRACE is set, no stack trace information is produced.

See the following example of stack trace information. The program generates an error at line 12:

program ovf                     
real*4 x(5),y(5)
integer*4 i

x(1) = -1e32
x(2) = 1e38
x(3) = 1e38
x(4) = 1e38
x(5) = -36.0

do i=1,5
  y(i) = 100.0*(x(i))
  print *, 'x = ', x(i), ' x*100.0 = ',y(i)
end do
end

>
ifort -O0 -fpe0 -traceback ovf.f90 -o ovf.exe
> ovf.exe

x =  -1.0000000E+32  x*100.0 =  -1.0000000E+34    (1)
forrtl: error (72): floating overflow
Image        PC         Routine       Line      Source
ovf.exe      08049E4A   MAIN__             14   ovf.f90
ovf.exe      08049F08   Unknown       Unknown   Unknown
ovf.exe      400B3507   Unknown       Unknown   Unknown
ovf.exe      08049C51   Unknown       Unknown   Unknown
Abort

>
setenv FOR_DISABLE_STACK_TRACE true
>
ovf.exe

x =  -1.0000000E+32  x*100.0 =  -1.0000000E+34
forrtl: error (72): floating overflow              (2)
Abort

The following information corresponds to the numbers at the right of the example:

(1) Stack trace information when the traceback information is present.

(2) No stack trace information, because the FOR_DISABLE_STACK_TRACE environment variable is set.

Values Returned to the Shell at Program Termination

An Intel Fortran program can terminate in one of several ways:

Forcing a Core Dump for Severe Errors

You can force a core dump for severe errors that do not usually cause a core file to be created. Before running the program, set the decfort_dump_flag environment variable to any of the common TRUE values (Y, y, Yes, yEs, True, and so forth) to cause severe errors to create a core file. For instance, the following C shell command sets the decfort_dump_flag environment variable:

setenv decfort_dump_flag y

The core file is written to the current directory and can be examined using a debugger.

Note

If you requested a core file to be created on severe errors and you don't get one when expected, the problem might be that your process limit for the allowable size of a core file is set too low (or to zero). See the man page for your shell for information on setting process limits. For example, the C shell command limit (with no arguments) will report your current settings, and limit coredumpsize unlimited will raise the allowable limit to your current system maximum.