-qflttrap

Category

Error checking and debugging

Purpose

Determines what types of floating-point exceptions to detect at run time.

The program receives a SIGTRAP signal when the corresponding exception occurs.

Syntax

Read syntax diagramSkip visual syntax diagram
        .-noflttrap------------------------------.   
>>- -q--+-flttrap--+---------------------------+-+-------------><
                   |    .-:------------------. |     
                   |    |   .-ZEROdivide-.   | |     
                   |    |   +-UNDerflow--+   | |     
                   |    |   +-OVerflow---+   | |     
                   |    |   +-INValid----+   | |     
                   |    V   +-INEXact----+   | |     
                   '-=------+-ENable-----+---+-'     
                            +-IMPrecise--+           
                            '-NANQ-------'           

@PROCESS:

FLTTRAP[(suboptions)] | NOFLTTRAP

Defaults

-qnoflttrap

Parameters

ENable
Turn on checking for the specified exceptions in the main program so that the exceptions generate SIGTRAP signals. You must specify this suboption if you want to turn on exception trapping without modifying your source code.
IMPrecise
Only check for the specified exceptions on subprogram entry and exit. This suboption improves performance, but it can make the exact spot of the exception difficult to find.
INEXact
Detect and trap on floating-point inexact if exception-checking is enabled. Because inexact results are very common in floating-point calculations, you usually should not need to turn this type of exception on.
INValid
Detect and trap on floating-point invalid operations if exception-checking is enabled.
NANQ
Detect and trap on all quiet not-a-number values (NaNQs) and signaling not-a-number values (NaNSs). Trapping code is generated regardless of specifying the enable or imprecise suboption. This suboption detects all NaN values handled by or generated by floating-point instructions, including those not created by invalid operations. This option can impact performance.
OVerflow
Detect and trap on floating-point overflow if exception-checking is enabled.
UNDerflow
Detect and trap on floating-point underflow if exception-checking is enabled.
ZEROdivide
Detect and trap on floating-point division by zero if exception-checking is enabled.

Usage

Specifying -qflttrap option with no suboptions is equivalent to -qflttrap=invalid:inexact:overflow:undflow:zerodivide

Exceptions will be detected by the hardware, but trapping is not enabled. Because this default does not include enable, it is probably only useful if you already use fpsets or similar subroutines in your source.

If you specify -qflttrap more than once, both with and without suboptions, the -qflttrap without suboptions is ignored.

The -qflttrap option is recognized during linking with IPA. Specifying the option at the link step overrides the compile-time setting.

If you use -qflttrap=inv:en to compile a program containing an IEEE invalid SQRT operation and you specify a -qarch target that does not implement the sqrt instruction set, the expected SIGTRAP signal will not occur when you run the program. You can fix this problem by specifying the following command before running the program:
export SQRT_EXCEPTION=3.1
Note: Due to the transformations performed and the exception handling support of some vector instructions, use of -qsimd=auto may change the location where an exception is caught or even cause the compiler to miss catching an exception.

For full instructions on how and when to use the -qflttrap option, especially if you are just starting to use it, see the Detecting and trapping floating-point exceptions topic.

Example

REAL :: x, y, z
DATA x /5.0/, y /0.0/
z = x / y
PRINT	*, z
END
When you compile this program with the following command, the program stops when the division is performed.
xlf -qflttrap=zerodivide:enable -qsigtrap divide_by_zero.f

The zerodivide suboption identifies the type of exception to guard against. The enable suboption causes a SIGTRAP signal to be generated when the exception occurs. The -qsigtrap option produces informative output when the signal stops the program.

Related information