NetBSD Problem Report #43303

From martin@duskware.de  Thu May 13 18:57:40 2010
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 6CE5163B898
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 13 May 2010 18:57:40 +0000 (UTC)
Message-Id: <20100513185739.CA22063B10E@mail.netbsd.org>
Date: Thu, 13 May 2010 18:57:39 +0000 (UTC)
From: martin@NetBSD.org
Reply-To: martin@NetBSD.org
To: gnats-bugs@gnats.NetBSD.org
Subject: __builtin_huge_val() generates illegal code on vax
X-Send-Pr-Version: 3.95

>Number:         43303
>Category:       toolchain
>Synopsis:       __builtin_huge_val() generates illegal code on vax
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 13 19:00:00 +0000 2010
>Closed-Date:    Sun May 16 11:30:20 +0000 2010
>Last-Modified:  Fri Jul 16 19:05:02 +0000 2010
>Originator:     Martin Husemann
>Release:        NetBSD 5.99.29
>Organization:
The NetBSD Foundation, Inc.
>Environment:
System: NetBSD dead-to-the-world.duskware.de 5.99.29 NetBSD 5.99.29 (DEAD) #31: Wed May 12 19:07:50 CEST 2010 martin@night-porter.duskware.de:/usr/src/sys/arch/vax/compile/DEAD vax
Architecture: vax
Machine: vax
>Description:

This simple test program:

#include <stdio.h>
#include <math.h>

int main(int argc, char **argv)
{
	double hv = HUGE_VAL;

	printf("double: %f\n", hv);
	return 0;
}

causes a SIGILL when run, the asm code that fails is:

	movd $0d+Inf,-12(%fp)


>How-To-Repeat:
s/a

>Fix:
fix gcc's idea of __builtin_huge_val() for vax

>Release-Note:

>Audit-Trail:
From: "Michael L. Hitch" <mhitch@lightning.msu.montana.edu>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/43303: __builtin_huge_val() generates illegal code on
 vax
Date: Sat, 15 May 2010 13:10:36 -0600 (MDT)

 On Thu, 13 May 2010, martin@NetBSD.org wrote:

 > causes a SIGILL when run, the asm code that fails is:
 >
 > 	movd $0d+Inf,-12(%fp)
 ...
 >> Fix:
 > fix gcc's idea of __builtin_huge_val() for vax

    Hmmm...  It looks to me like atof_vax.c is missing the support for
 Nan, +Inf, and -Inf.  There's a comment at line 271 of 
 src/external/gpl3/binutils/dist/gas/config/atof-vax.c:

            /* JF: Deal with new Nan, +Inf and -Inf codes.  */

    But it only checks for '+' and '-' in f->sign;  f->sign will contain 0 
 for Nan, 'P' for +Inf, and 'N' for -Inf (set by atof_generic()).  It
 then generates an invalid floating point number.

 --
 Michael L. Hitch			mhitch@montana.edu
 Computer Consultant
 Information Technology Center
 Montana State University	Bozeman, MT	USA

From: "Michael L. Hitch" <mhitch@lightning.msu.montana.edu>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/43303: __builtin_huge_val() generates illegal code on
 vax
Date: Sat, 15 May 2010 13:43:16 -0600 (MDT)

 On Sat, 15 May 2010, Michael L. Hitch wrote:

 > >> Fix:
 > > fix gcc's idea of __builtin_huge_val() for vax
 >
 >    Hmmm...  It looks to me like atof_vax.c is missing the support for
 > Nan, +Inf, and -Inf.  There's a comment at line 271 of
 > src/external/gpl3/binutils/dist/gas/config/atof-vax.c:
 >
 >            /* JF: Deal with new Nan, +Inf and -Inf codes.  */
 >
 >    But it only checks for '+' and '-' in f->sign;  f->sign will contain 0
 > for Nan, 'P' for +Inf, and 'N' for -Inf (set by atof_generic()).  It
 > then generates an invalid floating point number.

    And it looks like Matt Thomas had already proposed a fix for this:
 http://sourceware.org/ml/binutils/2009-04/msg00045.html

 --
 Michael L. Hitch			mhitch@montana.edu
 Computer Consultant
 Information Technology Center
 Montana State University	Bozeman, MT	USA

From: Martin Husemann <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/43303 CVS commit: src/external/gpl3/binutils/dist/gas
Date: Sun, 16 May 2010 11:20:01 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Sun May 16 11:20:01 UTC 2010

 Modified Files:
 	src/external/gpl3/binutils/dist/gas: atof-generic.c
 	src/external/gpl3/binutils/dist/gas/config: atof-vax.c

 Log Message:
 From Matt Thomas, suggested upstream:

 	* atof-generic.c (atof_generic): recognize snan and qnan in
 	addition to nan and inf.
 	* atof-vax.c (flonum_gen2vax): deal properly with nan, snan, qnan,
 	and +Inf and -Inf codes.

 This fixes PR toolchain/43303.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.1 -r1.2 \
     src/external/gpl3/binutils/dist/gas/atof-generic.c
 cvs rdiff -u -r1.1.1.1 -r1.2 \
     src/external/gpl3/binutils/dist/gas/config/atof-vax.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: martin@NetBSD.org
State-Changed-When: Sun, 16 May 2010 11:30:20 +0000
State-Changed-Why:
fixed


From: Jeff Rizzo <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/43303 CVS commit: [netbsd-5] src/gnu/dist/binutils/gas
Date: Fri, 16 Jul 2010 19:03:21 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Fri Jul 16 19:03:21 UTC 2010

 Modified Files:
 	src/gnu/dist/binutils/gas [netbsd-5]: atof-generic.c
 	src/gnu/dist/binutils/gas/config [netbsd-5]: atof-vax.c

 Log Message:
 Pull up following revision(s) (requested by jklos in ticket #1427):
 	gnu/dist/binutils/gas/config/atof-vax.c
 	gnu/dist/binutils/gas/atof-generic.c
 From Matt Thomas, suggested upstream:
 	* atof-generic.c (atof_generic): recognize snan and qnan in
 	addition to nan and inf.
 	* atof-vax.c (flonum_gen2vax): deal properly with nan, snan, qnan,
 	and +Inf and -Inf codes.
 This fixes PR toolchain/43303.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1.1.3 -r1.1.1.3.26.1 \
     src/gnu/dist/binutils/gas/atof-generic.c
 cvs rdiff -u -r1.1.1.1 -r1.1.1.1.38.1 \
     src/gnu/dist/binutils/gas/config/atof-vax.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.