public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* LDBL_EQ_DBL Multilib Issues
@ 2023-09-26 14:42 Joel Sherrill
  2023-09-26 22:39 ` Jeff Johnston
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Sherrill @ 2023-09-26 14:42 UTC (permalink / raw)
  To: Newlib, Chris Johns, Gedare Bloom


[-- Attachment #1.1: Type: text/plain, Size: 701 bytes --]

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?

[-- Attachment #2: ldbl.c --]
[-- Type: application/octet-stream, Size: 544 bytes --]

/* 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LDBL_EQ_DBL Multilib Issues
  2023-09-26 14:42 LDBL_EQ_DBL Multilib Issues Joel Sherrill
@ 2023-09-26 22:39 ` Jeff Johnston
  2023-09-26 23:18   ` Joel Sherrill
  0 siblings, 1 reply; 3+ messages in thread
From: Jeff Johnston @ 2023-09-26 22:39 UTC (permalink / raw)
  To: joel; +Cc: Newlib, Chris Johns, Gedare Bloom

[-- Attachment #1: Type: text/plain, Size: 1084 bytes --]

Have you thought about adding a special case in sys/config.h which
when it has the appropriate conditions (platform plus compiler flag) will
define/redefine _LDBL_EQ_DBL?

It gets included as part of _ansi.h and after newlib.h.

-- Jeff J.


On Tue, Sep 26, 2023 at 10:43 AM Joel Sherrill <joel@rtems.org> wrote:

> 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?
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LDBL_EQ_DBL Multilib Issues
  2023-09-26 22:39 ` Jeff Johnston
@ 2023-09-26 23:18   ` Joel Sherrill
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Sherrill @ 2023-09-26 23:18 UTC (permalink / raw)
  To: Jeff Johnston; +Cc: Newlib, Chris Johns, Gedare Bloom

[-- Attachment #1: Type: text/plain, Size: 1392 bytes --]

On Tue, Sep 26, 2023 at 5:40 PM Jeff Johnston <jjohnstn@redhat.com> wrote:

> Have you thought about adding a special case in sys/config.h which
> when it has the appropriate conditions (platform plus compiler flag) will
> define/redefine _LDBL_EQ_DBL?
>
> It gets included as part of _ansi.h and after newlib.h.
>

Thanks! You are confirming it needs to be decided at build time and giving
me the location to move it to.

I will try to get a patch out as soon as I can.

Thanks.

--joel

>
> -- Jeff J.
>
>
> On Tue, Sep 26, 2023 at 10:43 AM Joel Sherrill <joel@rtems.org> wrote:
>
>> 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?
>>
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-26 23:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-26 14:42 LDBL_EQ_DBL Multilib Issues Joel Sherrill
2023-09-26 22:39 ` Jeff Johnston
2023-09-26 23:18   ` Joel Sherrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).