NetBSD Problem Report #36988

From sjamaan@byers.homeunix.org  Fri Sep 14 11:12:20 2007
Return-Path: <sjamaan@byers.homeunix.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 9937763B8E9
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 14 Sep 2007 11:12:20 +0000 (UTC)
Message-Id: <20070913231556.6BA7720E089@byers.homeunix.org>
Date: Fri, 14 Sep 2007 01:15:56 +0200 (CEST)
From: Peter.Bex@xs4all.nl
Reply-To: Peter.Bex@xs4all.nl
To: gnats-bugs@NetBSD.org
Subject: math.h C99 constants are not constant
X-Send-Pr-Version: 3.95

>Number:         36988
>Category:       standards
>Synopsis:       INFINITY, HUGE_VALF etc are not real constants
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    joerg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Sep 14 11:15:01 +0000 2007
>Closed-Date:    Tue Feb 23 00:04:07 +0000 2010
>Last-Modified:  Sat Mar 06 22:05:02 +0000 2010
>Originator:     Peter.Bex@xs4all.nl
>Release:        NetBSD 4.0_RC1
>Organization:

>Environment:


System: NetBSD byers.homeunix.org 4.0_RC1 NetBSD 4.0_RC1 (GENERIC) #0: Mon Sep 3 21:50:07 CEST 2007 sjamaan@byers.homeunix.org:/usr/src/sys/arch/macppc/compile/GENERIC macppc
Architecture: powerpc
Machine: macppc
>Description:

The C99 spec says that INFINITY, HUGE_VALF, HUGE_VALL, NAN and HUGE_VAL
should expand to a constant expression.  They don't.

This means that these values cannot be used as initializers.

>How-To-Repeat:

Try to compile the program:

#include <math.h>
double x = INFINITY;
int main(void)
{
	printf("X = %f\n", x);
	return 0;
}

GCC will complain:
infinity.c:2: error: initializer element is not constant
>Fix:
	N/A

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: standards-manager->joerg
Responsible-Changed-By: joerg@NetBSD.org
Responsible-Changed-When: Mon, 22 Feb 2010 14:18:23 +0000
Responsible-Changed-Why:
Take it.


State-Changed-From-To: open->closed
State-Changed-By: joerg@NetBSD.org
State-Changed-When: Tue, 23 Feb 2010 00:04:07 +0000
State-Changed-Why:
Fixed. Thanks for the PR.


From: Joerg Sonnenberger <joerg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/36988 CVS commit: src/include
Date: Tue, 23 Feb 2010 00:03:10 +0000

 Module Name:	src
 Committed By:	joerg
 Date:		Tue Feb 23 00:03:10 UTC 2010

 Modified Files:
 	src/include: math.h

 Log Message:
 PR 36988: ISO C99 mandates that HUGE_VAL, HUGE_VALF, HUGE_VALL and
 INFINITY are constant expressions.

 Use the GCC builtins if possible to implement them.


 To generate a diff of this commit:
 cvs rdiff -u -r1.50 -r1.51 src/include/math.h

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

From: Stephen Borrill <sborrill@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/36988 CVS commit: [netbsd-5] src/include
Date: Sat, 6 Mar 2010 22:02:41 +0000

 Module Name:	src
 Committed By:	sborrill
 Date:		Sat Mar  6 22:02:41 UTC 2010

 Modified Files:
 	src/include [netbsd-5]: math.h

 Log Message:
 Pull up the following revisions(s) (requested by joerg in ticket #1315):
 	include/math.h:	revision 1.51

 Address PR#36988: ISO C99 mandates that HUGE_VAL, HUGE_VALF, HUGE_VALL and
 INFINITY are constant expressions.
 Use the GCC builtins if possible to implement them.


 To generate a diff of this commit:
 cvs rdiff -u -r1.47 -r1.47.8.1 src/include/math.h

 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.