LDBL_EQ_DBL Multilib Issues

Joel Sherrill <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <CAF9ehCVdL2TMem1aOpznbGnASn9d9NmJShcx-t25DY4L23Qaag@mail.gmail.com>
Hi

I wondered when we reorganized LDBL_EQ_DBL logic if there wouldn't be a
multilib edge case. Chris encountered it.

Attached is a simple test program based on the autoconf probe in
configure.ac that can be preprocessed with different CPU/ABI flags. The
following shows that the default on m68k is not the same as for the 5282.

$ m68k-rtems6-gcc -O2 -E ldbl.c | less

$ m68k-rtems6-gcc -O2 -E -mcpu=5282 ldbl.c | less

Turns out the default flags end up with LDBL_EQ_DBL isn't defined but it
should be for -mcpu=5282 builds.

I don't know any mechanism to add header file variants in newlib by
multilib, so I we need to consider moving this to a dynamic check.

Any thoughts on where to move this?
ldbl.c (application/octet-stream, 544 B)
/* guts of test from newlib/configure.ac */
#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

/* just to get values */
int sDBL_MANT_DIG = DBL_MANT_DIG;
int sLDBL_MANT_DIG = LDBL_MANT_DIG;
int sLDBL_MIN_EXP = LDBL_MIN_EXP;
int sDBL_MIN_EXP = DBL_MIN_EXP;
int sLDBL_MAX_EXP = LDBL_MAX_EXP;
int sDBL_MAX_EXP = DBL_MAX_EXP;

const char *ldbl_eq_dbl =
#ifdef LDBL_EQ_DBL
  "defined";
#else
  "undefined";
#endif
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.