This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Possible Issue in ieeefp.h


On 11/21/2016 03:12 PM, Joel Sherrill wrote:


On 11/21/2016 12:03 PM, Joel Sherrill wrote:


On 11/21/2016 10:52 AM, Craig Howland wrote:

...

Hmm.. my C/C++ toolset has this in float.h which looks correct:

/* Number of base-FLT_RADIX digits in the significand, p.  */
#undef FLT_MANT_DIG
#undef DBL_MANT_DIG
#undef LDBL_MANT_DIG
#define FLT_MANT_DIG    __FLT_MANT_DIG__
#define DBL_MANT_DIG    __DBL_MANT_DIG__
#define LDBL_MANT_DIG   __LDBL_MANT_DIG__

I will ask the user what the one in their build tree looks like.
If that looks OK, maybe the source file that isn't compiling
isn't including float.h. The user report doesn't go back far enough
to have a file -- only errors in ieeefp.h.

I have a thread to pull on. Thanks.

And I have something more concrete. :)

So far multiple RTEMS targets have built FORTRAN OK. But
the i386 (which is the one the user was trying) fails
with this:

/home/joel/rtems-4.11-work/rtems-source-builder/rtems/build/i386-rtems4.12-gcc-6-20161110-newlib-2.4.0.20161025-x86_64-linux-gnu-1/gcc-6-20161110/newlib/libc/include/ieeefp.h:152:2: error: #error "double and long double are the same size but LDBL_EQ_DBL is not defined"
 #error "double and long double are the same size but LDBL_EQ_DBL is not defined"
  ^~~~~

The versions of gcc and newlib are in this version string
from sparc-rtems4.12-gcc:

sparc-rtems4.12-gcc (GCC) 6.2.1 20161110 (RTEMS 4.12, RSB 1c68dbb293922863d5f48ec05559b0fc4b4ea893, Newlib 2.4.0.20161025)

It is nice to see ieeefp.h being defensive. Is the bug
in machine/ieeefp.h which should define this?

Thanks again.

--joel

No, LDBL_EQ_DBL is supposed to be defined by configure. That check is also rigorous, not only requiring the mantissa length, but also the exponent range. As a guess, one of the latter two is perhaps missing from your float.h.

#include <float.h>
#if DBL_MANT_DIG == LDBL_MANT_DIG  &&  LDBL_MIN_EXP == DBL_MIN_EXP  && \
    LDBL_MAX_EXP == DBL_MAX_EXP
  #define _LDBL_EQ_DBL
 #else
  #error "LDBL != DBL"
#endif

Craig


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