[gfortran,patch] Add option to raise FPE
Richard Guenther
richard.guenther@gmail.com
Thu Aug 25 11:13:00 GMT 2005
On 8/20/05, François-Xavier Coudert <fxcoudert@gmail.com> wrote:
> Hi all,
>
> Attached patch adds support for an interesting feature present in many
> commercial compilers: raising a floating-point exception (FPE) when a
> IEEE exception is encountered (invalid operation, such as sqrt(-1.0),
> overflow, underflow, division by zero, loss of precision and denormal
> numbers). This is very interesting for debugging, since it enables one to
> know where a numerical computation have gone wrong, when you do not
> expect NaN to creep into your results, for example.
>
> Commercial compilers allow to do this with a compile-time option, which I
> added to gfortran: I called it -ffpe-trap, though -ffpe-raise might be a
> better name (any other ideas welcome). It is to be used in the following
> way:
> gfortran fpe-test.f90 -ffpe-trap=invalid,overflow
> where -ffpe-trap accepts a comma-separated list of IEEE exceptions
> (invalid,overflow,underflow,zero,precision,denormal).
Please try to make this language independend! It's useful at least
for C and C++,
too. You might want to look at HJs patch to disable denormals handling on i386.
Richard.
More information about the Fortran
mailing list