bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

isnan: work around a DEC C compiler bug


From: Bruno Haible
Subject: isnan: work around a DEC C compiler bug
Date: Sun, 25 Mar 2007 21:44:53 +0200
User-agent: KMail/1.5.4

The DEC C 6.4 compiler on Tru64 fails with an error message when it encounters
the expression 0.0 / 0.0, even in a context where no constant expression is
required. Strangely enough, it groks 0.0L / 0.0L with just a warning. Here is
a workaround:

2007-03-25  Bruno Haible  <address@hidden>

        * lib/isnan.c (FUNC): Work around a DEC C compiler bug.

*** lib/isnan.c 25 Mar 2007 01:06:39 -0000      1.4
--- lib/isnan.c 25 Mar 2007 19:41:35 -0000
***************
*** 64,74 ****
       because x may be a signaling NaN.  */
  # if defined __SUNPRO_C || defined __DECC
    /* The Sun C 5.0 compilers and the Compaq (ex-DEC) 6.4 compilers don't
!      recognize the initializers as constant expressions.  */
    memory_double nan;
    DOUBLE plus_inf = L_(1.0) / L_(0.0);
    DOUBLE minus_inf = -L_(1.0) / L_(0.0);
!   nan.value = L_(0.0) / L_(0.0);
  # else
    static memory_double nan = { L_(0.0) / L_(0.0) };
    static DOUBLE plus_inf = L_(1.0) / L_(0.0);
--- 64,77 ----
       because x may be a signaling NaN.  */
  # if defined __SUNPRO_C || defined __DECC
    /* The Sun C 5.0 compilers and the Compaq (ex-DEC) 6.4 compilers don't
!      recognize the initializers as constant expressions.  The latter compiler
!      also fails when constant-folding 0.0 / 0.0 even when constant-folding is
!      not required.  */
!   static DOUBLE zero = L_(0.0);
    memory_double nan;
    DOUBLE plus_inf = L_(1.0) / L_(0.0);
    DOUBLE minus_inf = -L_(1.0) / L_(0.0);
!   nan.value = zero / zero;
  # else
    static memory_double nan = { L_(0.0) / L_(0.0) };
    static DOUBLE plus_inf = L_(1.0) / L_(0.0);





reply via email to

[Prev in Thread] Current Thread [Next in Thread]