This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: update code example in g77 documentation


>>>>> Matthias Klose writes:

 > Update code example g77 documentation as proposed in
 > http://gcc.gnu.org/ml/gcc-bugs/1999-11/msg00846.html and 
 > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=72594&repeatmerged=yes

 > However there still is one code example in the Optimization section,
 > which uses __setfpucw.

 > Sat Nov 18 13:54:49 2000  Matthias Klose  <doko@cs.tu-berlin.de> 
 
 > 	* g77.texi (Floating-point Exception Handling): Adjust 
 > 	example to work with glibc (>= 2.1). 


 > --- gcc/f/g77.texi~	Mon Jun 21 13:58:54 1999
 > +++ gcc/f/g77.texi	Sat Nov 18 13:49:43 2000
 > @@ -12144,8 +12144,10 @@
 >  static void __attribute__ ((constructor))
 >  trapfpe ()
 >  @{
 > -  __setfpucw (_FPU_DEFAULT &
 > -              ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM));
 > +  fpu_control_t cw =
 > +    _FPU_DEFAULT &
 > +    ~(_FPU_MASK_IM | _FPU_MASK_ZM | _FPU_MASK_OM);
 > +  _FPU_SETCW(cw);
 >  @}
 >  @end smallexample


I don't agree with this change - it will only work on some platforms
but not on all.  glibc 2.2 has a superior solution for this, it's
called feenableexcept and fedisableexcept.  The following will work on
most platforms:

fedisableexcept (FE_INVALID|FE_DIVBYZERO|FE_OVERFLOW);

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]