During execution, your program may encounter errors or exception conditions. These conditions can result from any of the following:
Errors that occur during I/O operations
Invalid input data
Argument errors in calls to the mathematical library
Arithmetic errors
Other system-detected errors
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:
The severity of the error. For instance, the program usually continues executing when an error message with a severity level of warning or info (informational) is detected.
For certain errors associated with I/O statements, whether or not an I/O error-handling specifier was specified.
For certain errors, whether or not the default action of an associated signal was changed.
For certain errors related to arithmetic operations (including floating-point exceptions), compilation options can determine whether the error is reported and the severity of the reported error.
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:
The -check bounds option generates extra code to catch certain conditions.
The -check noformat and -check nooutput_conversion options reduce the severity level of the associated run-time error to allow program continuation.
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:
forrtl identifies the source as the Intel Fortran RTL.
severity identifies the severity level: severe, error, warning, or info.
nnn identifies the message number; also the IOSTAT value for I/O statements.
message-text explains the event that caused the message.
The severity levels are described in order of greatest to least severity:
A severe message must be corrected. The program's execution is terminated when the error is encountered, unless the program's I/O statements use the END, EOR, or ERR branch specifiers to transfer control, perhaps to a routine that uses the IOSTAT specifier.
An error message should be corrected. The program might continue execution, but the output from this execution may be incorrect.
A warning message should be investigated. The program continues execution, but output from this execution may be incorrect.
An info message is for informational purposes only. The program continues.
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.
An Intel Fortran program can terminate in one of several ways:
The program runs to normal completion. A value of zero is returned to the shell.
The program stops with a STOP or a PAUSE statement. A value of zero is returned to the shell.
The program stops because of a signal that is caught but does not allow the program to continue. A value of 1 is returned to the shell.
The program stops because of a severe run-time error. The error number for that run-time error is returned to the shell.
The program stops with a CALL EXIT statement. The value passed to EXIT is returned to the shell.
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.