From cfe83a543f912bda277a1dc8b4defaf2c86f4fc4 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 21 Nov 2000 12:12:22 +0100 Subject: g77.texi (Floating-point Exception Handling): Use feenableexcept in example. * g77.texi (Floating-point Exception Handling): Use feenableexcept in example. (Floating-point precision): Change to match above change. From-SVN: r37613 --- gcc/f/ChangeLog | 6 ++++++ gcc/f/g77.texi | 17 +++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'gcc') diff --git a/gcc/f/ChangeLog b/gcc/f/ChangeLog index 9cc87fb..61a1f52 100644 --- a/gcc/f/ChangeLog +++ b/gcc/f/ChangeLog @@ -1,3 +1,9 @@ +2000-11-21 Andreas Jaeger + + * g77.texi (Floating-point Exception Handling): Use feenableexcept + in example. + (Floating-point precision): Change to match above change. + Sun Nov 19 17:29:22 2000 Matthias Klose * g77.texi (Floating-point precision): Adjust example diff --git a/gcc/f/g77.texi b/gcc/f/g77.texi index 72a793c..842f4e4 100644 --- a/gcc/f/g77.texi +++ b/gcc/f/g77.texi @@ -10475,9 +10475,10 @@ mode and not take the performance hit of @samp{-ffloat-store}. On x86 and m68k GNU systems you can do this with a technique similar to that for turning on floating-point exceptions (@pxref{Floating-point Exception Handling}). -The control word could be set to double precision by -replacing the @code{__setfpucw} call or the @code{_FPU_SETCW} macro with one like this: +The control word could be set to double precision by some code like this +one: @smallexample +#include @{ fpu_control_t cw = (_FPU_DEFAULT & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(cw); @@ -12150,17 +12151,17 @@ Most systems provide some C-callable mechanism to change this; this can be invoked at startup using @code{gcc}'s @code{constructor} attribute. For example, just compiling and linking the following C code with your program will turn on exception trapping for the ``common'' exceptions -on an x86-based GNU system: +on a GNU system using glibc 2.2 or newer: @smallexample -#include +#define _GNU_SOURCE 1 +#include static void __attribute__ ((constructor)) trapfpe () @{ - fpu_control_t cw = - _FPU_DEFAULT & - ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM); - _FPU_SETCW(cw); + /* Enable some exceptions. At startup all exceptions are masked. */ + + feenableexcept (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW); @} @end smallexample -- cgit v1.1