-qflttrap

Description

Generates extra instructions to detect and trap runtime floating-point exceptions.

Syntax

Read syntax diagramSkip visual syntax diagram        .-noflttrap----------------------------.
>>- -q--+-flttrap--+-------------------------+-+---------------><
                   |    .-:----------------. |
                   |    V                  | |
                   '-=----+-overflow-----+-+-'
                          +-underflow----+
                          +-zerodivide---+
                          +-invalid------+
                          +-inexact------+
                          +-enable-------+
                          +-imprecise----+
                          '-+----+--nanq-'
                            '-no-'

where suboptions do the following:

ENable Enables the specified exceptions in the prologue of the main program. With the exception of nanq (described below), this suboption is required if you want to turn on exception trapping options listed below without modifying the source code.
OVerflow Generates code to detect and trap floating-point overflow.
UNDerflow Generates code to detect and trap floating-point underflow.
ZEROdivide Generates code to detect and trap floating-point division by zero.
INValid Generates code to detect and trap floating-point invalid operation exceptions.
INEXact Generates code to detect and trap floating-point inexact exceptions.
IMPrecise Generates code for imprecise detection of the specified exceptions. If an exception occurs, it is detected, but the exact location of the exception is not determined.
NANQ Generates code to detect and trap NaNQ (Not a Number Quiet) exceptions handled by or generated by floating point operations. The nanq and nonanq settings are not affected by -qnoflttrap, -qflttrap, or -qflttrap=enable.

Notes

This option is recognized during linking. -qnoflttrap specifies that these extra instructions need not be generated.

Specifying the -qflttrap option with no suboptions is equivalent to setting -qflttrap=overflow:underflow:zerodivide:invalid:inexact. The exceptions are not automatically enabled, and all floating-point operations are checked to provide precise exception-location information.

If specified with #pragma options, the -qnoflttrap option must be the first option specified.

If your program contains signalling NaNs, you should use the -qfloat=nans along with -qflttrap to trap any exceptions.

The compiler exhibits behavior as illustrated in the following examples when the -qflttrap option is specified together with -qoptimize options:

Example

To compile myprogram.c so that floating-point overflow and underflow and divide by zero are detected, enter:

xlc myprogram.c -qflttrap=overflow:underflow:zerodivide:enable

Related information