The GNU Fortran Compiler: _gfortran_set_fpe

Next: _gfortran_set_max_subrecord_length, Previous: _gfortran_set_record_marker, Up: Non-Fortran Main Program [Contents][Index]

#### 7.3.5 `_gfortran_set_fpe` — Enable floating point exception traps

Description:

  `_gfortran_set_fpe` enables floating point exception traps for the specified exceptions. On most systems, this will result in a SIGFPE signal being sent and the program being aborted.

Syntax:

  `void _gfortran_set_fpe (int val)`

Arguments:

  option[0] | IEEE exceptions. Possible values are (bitwise or-ed) zero (0, default) no trapping, `GFC_FPE_INVALID` (1), `GFC_FPE_DENORMAL` (2), `GFC_FPE_ZERO` (4), `GFC_FPE_OVERFLOW` (8), `GFC_FPE_UNDERFLOW` (16), and `GFC_FPE_INEXACT` (32).

Example:

      int main (int argc, char *argv[])
      {
        /* Initialize libgfortran.  */
        _gfortran_set_args (argc, argv);
        /* FPE for invalid operations such as SQRT(-1.0).  */
        _gfortran_set_fpe (1);
        return 0;
      }