gfortran45 IEEE exceptions are in the manual, but not supported?

FX fxcoudert@gmail.com
Fri Feb 25 09:19:00 GMT 2011


> TZAV> gfortran45 -ffpe-trap=underflow,overflow,zero,denormal,invalid,precision ieee-except.f90
> 
> TZAV> ./a.out 
> Fortran runtime warning: IEEE 'denormal number' exception not supported.
> Floating exception (core dumped)

Great!

> What about denormal?

The FreeBSD manpage for fpsetmask() at http://tinyurl.com/64oo7zh says:

>      #define FP_X_DNML	     0x02    /* denormal */


so it is, in principle, available. However, looking at the FreeBSD 8 source tree, I see for sys/ia64/include/ieeefp.h:

#define	FP_X_INV	IA64_FPSR_TRAP_VD /* invalid operation exception */
#define	FP_X_DZ		IA64_FPSR_TRAP_ZD /* divide-by-zero exception */
#define	FP_X_OFL	IA64_FPSR_TRAP_OD /* overflow exception */
#define	FP_X_UFL	IA64_FPSR_TRAP_UD /* underflow exception */
#define	FP_X_IMP	IA64_FPSR_TRAP_ID /* imprecise(inexact) exception */

which means underflow is not a supported exception, while it is for amd64:

#define FP_X_DNML	0x02	/* denormal */

and also for i386:

#define FP_X_DNML	0x02	/* denormal */


So, in this case, it's actually an OS issue!


> And what about sparc64? Should a similar patch be used there as well?

The same patch should work on all FreeBSD variants, please try it on sparc64 and tell me what happens. According to sys/sparc64/include/ieeefp.h, trap on denormal will on be enabled.


If you report that the patch works for sparc64-freebsd also, I will submit it for review and inclusion in 4.6 (and maybe 4.5, I don't think it hurts, but it's up to the maintainers to decide).


Cheers,
FX



More information about the Fortran mailing list