Previous: _gfortran_set_max_subrecord_length, Up: Non-Fortran Main Program

7.3.5 _gfortran_set_fpe — Set when a Floating Point Exception should be raised

_gfortran_set_fpe sets the IEEE exceptions for which a Floating Point Exception (FPE) should be raised. On most systems, this will result in a SIGFPE signal being sent and the program being interrupted.
void _gfortran_set_fpe (int val)

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_PRECISION (32).

          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;