From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13519 invoked by alias); 6 Aug 2004 20:38:37 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 13504 invoked from network); 6 Aug 2004 20:38:35 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (142.179.108.108) by sourceware.org with SMTP; 6 Aug 2004 20:38:35 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 29EC447D91; Fri, 6 Aug 2004 13:38:35 -0700 (PDT) Date: Fri, 06 Aug 2004 20:38:00 -0000 From: Joel Brobecker To: Andrew Cagney Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA/mips] Fix crash trying to print long double float Message-ID: <20040806203835.GW1192@gnat.com> References: <20040806181603.GQ1203@gnat.com> <4113E8D6.3000506@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4113E8D6.3000506@gnu.org> User-Agent: Mutt/1.4i X-SW-Source: 2004-08/txt/msg00173.txt.bz2 > Does the attached stop the crash? I will give it a go sometime this evening, but yes, I think it will prevent the crash. It's a good general guard. > 2004-08-06 Andrew Cagney > > * doublest.c: Update copyright. > (floatformat_from_length): Call error when floatformat is NULL. > (extract_floating_by_length): Remove NULL fmt check. > (store_floating_by_length): Ditto. 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. */ -- Joel