From: Andrew Cagney <cagney@gnu.org>
To: Joel Brobecker <brobecker@gnat.com>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA/mips] Fix crash trying to print long double float
Date: Fri, 06 Aug 2004 21:03:00 -0000 [thread overview]
Message-ID: <4113F1FB.1000902@gnu.org> (raw)
In-Reply-To: <20040806203835.GW1192@gnat.com>
> One question:
>
>
>>> @@ -633,12 +633,13 @@ floatformat_from_doublest (const struct
>>> static const struct floatformat *
>>> floatformat_from_length (int len)
>>> {
>>> + const struct floatformat *format;
>>> if (len * TARGET_CHAR_BIT == TARGET_FLOAT_BIT)
>>> - return TARGET_FLOAT_FORMAT;
>>> + format = TARGET_FLOAT_FORMAT;
>>> else if (len * TARGET_CHAR_BIT == TARGET_DOUBLE_BIT)
>>> - return TARGET_DOUBLE_FORMAT;
>>> + format = TARGET_DOUBLE_FORMAT;
>>> else if (len * TARGET_CHAR_BIT == TARGET_LONG_DOUBLE_BIT)
>>> - return TARGET_LONG_DOUBLE_FORMAT;
>>> + format = TARGET_LONG_DOUBLE_FORMAT;
>>> /* On i386 the 'long double' type takes 96 bits,
>>> while the real number of used bits is only 80,
>>> both in processor and in memory.
>>> @@ -646,9 +647,13 @@ floatformat_from_length (int len)
>>> else if ((TARGET_LONG_DOUBLE_FORMAT != NULL)
>>> && (len * TARGET_CHAR_BIT ==
>>> TARGET_LONG_DOUBLE_FORMAT->totalsize))
>>> - return TARGET_LONG_DOUBLE_FORMAT;
>>> -
>>> - return NULL;
>>> + format = TARGET_LONG_DOUBLE_FORMAT;
>>> + else
>>> + format = NULL;
>>> + if (format == NULL)
>>> + error ("This GDB does not support %d-bit floating-point values.",
>>> + len & TARGET_CHAR_BIT);
>>> + return format;
>>> }
>
>
> Why do you use a variable? wouldn't have it been simpler to
> add one line at the end like this:
>
> error ("bla bla bla");
> return NULL; /* Will never be reached. */
And:
if (TARGET_FLOAT_FORMAT != NULL && len * TARGET_CHAR_BIT ==
TARGET_FLOAT_BIT)
return TARGET_FLOAT_FORMAT;
...
else
error ("blah, blah");
I don't trust *_FORMAT to be non-NULL.
Andrew
next prev parent reply other threads:[~2004-08-06 21:03 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-06 18:16 Joel Brobecker
2004-08-06 20:24 ` Andrew Cagney
2004-08-06 20:38 ` Joel Brobecker
2004-08-06 21:03 ` Andrew Cagney [this message]
2004-08-07 17:18 ` Andrew Cagney
2004-08-06 20:32 ` Joel Brobecker
2004-08-07 18:01 ` Andrew Cagney
2004-08-07 18:09 ` Joel Brobecker
2004-08-07 18:22 ` Andrew Cagney
2004-08-08 6:59 ` Joel Brobecker
2004-08-08 16:57 ` Andrew Cagney
2004-08-09 5:46 ` Joel Brobecker
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=4113F1FB.1000902@gnu.org \
--to=cagney@gnu.org \
--cc=brobecker@gnat.com \
--cc=gdb-patches@sources.redhat.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