Subject: standards/30623: HUGE_VALx is not a constant expression
To: None <standards-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <rearnsha@netbsd.org>
List: netbsd-bugs
Date: 06/28/2005 15:41:00
>Number:         30623
>Category:       standards
>Synopsis:       HUGE_VALx is not a constant expression
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jun 28 15:41:00 +0000 2005
>Originator:     Richard Earnshaw
>Release:        3.99.5
>Organization:
ARM
>Environment:
All
>Description:
C99 (section 7.12) requires HUGE_VAL, HUGE_VALF and HUGE_VALL to be constant expressions (ie, that can be used as static initializers).  NetBSD's implementation uses a form that is constant, but not a constant expression.

>How-To-Repeat:
Compile the following program fragment:

#include <math.h>
float f = HUGE_VALF;
double d = HUGE_VAL;
long double l = HUGE_VALL;

gcc test.c -S
test.c:2: error: initializer element is not constant
test.c:3: error: initializer element is not constant
test.c:4: error: initializer element is not constant

>Fix: