From: Daniel Jacobowitz <drow@mvista.com>
To: Ian Lance Taylor <ian@wasabisystems.com>
Cc: gcc-patches@gcc.gnu.org, gdb-patches@sources.redhat.com
Subject: Re: RFA: Support infinity, NaN, and denormalized numbers in floatformat.c
Date: Wed, 03 Dec 2003 18:17:00 -0000 [thread overview]
Message-ID: <20031203181749.GA19055@nevyn.them.org> (raw)
In-Reply-To: <20031203181245.3896.qmail@gossamer.airs.com>
On Wed, Dec 03, 2003 at 01:12:45PM -0500, Ian Lance Taylor wrote:
> Here is a patch to improve the support for infinity, NaN, and
> denormalized numbers in floatformat.c. It's not clear how to handle
> these for non-IEEE formats. But the old code did entirely the wrong
> thing even when using IEEE formats, which are used by pretty much all
> modern processors. So I think we might as well do the right thing
> here.
>
> These patches cause the following compilation warnings on a Red Hat
> Linux 7.3 system:
>
> ../../gcc/libiberty/floatformat.c: In function `floatformat_to_double':
> ../../gcc/libiberty/floatformat.c:319: warning: traditional C rejects the 'u' suffix
> ../../gcc/libiberty/floatformat.c:319: warning: traditional C rejects initialization of unions
> ../../gcc/libiberty/floatformat.c:321: warning: traditional C rejects the 'f' suffix
>
> These are all cases in which the code is using macros which are
> defined by the standard <math.h> header (namely INFINITY and NAN). So
> these warnings do not indicate actual code problems. I don't see any
> obvious way to avoid them.
>
> After writing these patches, I decided to see what uses the
> floatformat routines. I discovered only one use: the m68k
> disassembler. gdb uses different routines which probably started as a
> copy of the floatformat routines, but use the type DOUBLEST which can
> be `long double' instead of `double'. The code has diverged, and
> there is some support there for denormalized numbers. It doesn't look
> right to me, but I haven't investigated much further.
For the record, that's not 100% correct - GDB doesn't use
floatformat_to_double or floatformat_from_double, but we do use the
rest of the file (is_valid, and all the actual floatformats). This is
fairly obvious after re-reading what you said but it gave me a turn the
first time :)
> It seems to me that the gdb code should move into libiberty. We can
> easily add floatformat_to_long_double and
> floatformat_from_long_double, which would only be available if the
> long double type is available. gdb would then call the appropriate
> function from libiberty. There is other gdb floatformat code which
> could move over as well, such as floatformat_is_negative() and
> floatformat_is_nan().
>
> Any other opinions on the best way to merge the libiberty and gdb
> implementations?
That sounds reasonable to me. floatformat_to_doublest could contain a
check on HAVE_LONG_DOUBLE and call one or the other.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-12-03 18:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-12-03 18:12 Ian Lance Taylor
2003-12-03 18:17 ` Daniel Jacobowitz [this message]
2003-12-03 19:09 ` Andrew Cagney
2003-12-03 18:35 ` Carlo Wood
2003-12-03 18:44 ` Ian Lance Taylor
2003-12-03 18:57 ` Carlo Wood
2003-12-03 18:35 ` DJ Delorie
2003-12-03 18:47 ` Paul Koning
2012-08-16 16:20 ` Andreas Schwab
2012-08-17 21:16 ` Ian Lance Taylor
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20031203181749.GA19055@nevyn.them.org \
--to=drow@mvista.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sources.redhat.com \
--cc=ian@wasabisystems.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox