From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19720 invoked by alias); 24 Nov 2002 22:55:59 -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 19589 invoked from network); 24 Nov 2002 22:55:58 -0000 Received: from unknown (HELO crack.them.org) (65.125.64.184) by sources.redhat.com with SMTP; 24 Nov 2002 22:55:58 -0000 Received: from nevyn.them.org ([66.93.61.169] ident=mail) by crack.them.org with asmtp (Exim 3.12 #1 (Debian)) id 18G7Xv-000141-00 for ; Sun, 24 Nov 2002 18:56:19 -0600 Received: from drow by nevyn.them.org with local (Exim 3.36 #1 (Debian)) id 18G5fZ-000163-00 for ; Sun, 24 Nov 2002 17:56:05 -0500 Date: Sun, 24 Nov 2002 14:55:00 -0000 From: Daniel Jacobowitz To: gdb-patches@sources.redhat.com Subject: PATCH for Re: Problems with floatformat on Alpha Message-ID: <20021124225605.GA2639@nevyn.them.org> Mail-Followup-To: gdb-patches@sources.redhat.com References: <20021124214447.GA1222@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021124214447.GA1222@nevyn.them.org> User-Agent: Mutt/1.5.1i X-SW-Source: 2002-11/txt/msg00592.txt.bz2 On Sun, Nov 24, 2002 at 04:44:47PM -0500, Daniel Jacobowitz wrote: > I spent some time today tracking problems in Alpha/Linux testsuite results. > One of the biggies was SIGFPE in convert_floatformat_to_doublest. The first > problem was pretty easy: > > else if (exponent == 0) > exponent = 1 - fmt->exp_bias; > > 1 is an int, exp_bias is an unsigned int, exponent is a long int. The math > is done unsigned and exponent is ridiculously large. > > I'm not sending a patch yet because I can't test it; something goes wrong > later, in the call to ldexp and elsewhere, that looks suspiciously like GDB > is miscompiled. Blech. Doublest is assuming an IEEE-ish host. More particularly, it appears that the mechanism doublest.c uses to construct doubles is not usable on Alpha in non-IEE mode. The instruction "addt $f10,$f11,$f10" can trap if $f10 is a denormal - even if $f11 is 0.0. I have test code which demonstrates this to my satisfaction. So when we accumulate in dto, we take a SIGFPE. Here's the patch I'm using. The doublest part is obvious and no one's caring for alpha-linux right now; so I'll check this in in a few days unless someone sees a problem. It assumes that the compiler for an alpha-linux host recognizes -mieee, which I'm comfortable with. -- Daniel Jacobowitz MontaVista Software Debian GNU/Linux Developer 2002-11-24 Daniel Jacobowitz * doublest.c (convert_floatformat_to_doublest): Cast exp_bias to int. * config/alpha/alpha-linux.mh (MH_CFLAGS): Add -mieee. --- gdb-5.2.debian90.cvs20021120/gdb/doublest.c.orig 2002-11-24 17:48:16.000000000 -0500 +++ gdb-5.2.debian90.cvs20021120/gdb/doublest.c 2002-11-24 17:48:25.000000000 -0500 @@ -177,7 +177,7 @@ if (!special_exponent) exponent -= fmt->exp_bias; else if (exponent == 0) - exponent = 1 - fmt->exp_bias; + exponent = 1 - (int)fmt->exp_bias; /* Build the result algebraically. Might go infinite, underflow, etc; who cares. */ --- gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh.orig 2002-11-24 17:50:30.000000000 -0500 +++ gdb-5.2.debian90.cvs20021120/gdb/config/alpha/alpha-linux.mh 2002-11-24 17:50:41.000000000 -0500 @@ -8,3 +8,5 @@ MMALLOC = MMALLOC_CFLAGS = -DNO_MMALLOC + +MH_CFLAGS = -mieee