From archie@FreeBSD.org  Mon Sep 30 16:09:50 2002
Return-Path: <archie@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 323F837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Sep 2002 16:09:50 -0700 (PDT)
Received: from panther.freebsd.org (panther.freebsd.org [216.136.204.99])
	by mx1.FreeBSD.org (Postfix) with ESMTP id DE76343E81
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Sep 2002 16:09:49 -0700 (PDT)
	(envelope-from archie@FreeBSD.org)
Received: from panther.freebsd.org (localhost [127.0.0.1])
	by panther.freebsd.org (8.12.6/8.12.6) with ESMTP id g8UN9nSX083275
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 30 Sep 2002 16:09:49 -0700 (PDT)
	(envelope-from archie@panther.freebsd.org)
Received: (from archie@localhost)
	by panther.freebsd.org (8.12.6/8.12.6/Submit) id g8UN9nWh083274;
	Mon, 30 Sep 2002 16:09:49 -0700 (PDT)
Message-Id: <200209302309.g8UN9nWh083274@panther.freebsd.org>
Date: Mon, 30 Sep 2002 16:09:49 -0700 (PDT)
From: Archie Cobbs <archie@FreeBSD.org>
Reply-To: Archie Cobbs <archie@FreeBSD.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Bogus definition of HUGE_VAL in <math.h>
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         43544
>Category:       bin
>Synopsis:       Bogus definition of HUGE_VAL in <math.h>
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 30 16:10:05 PDT 2002
>Closed-Date:    Thu Oct 31 15:08:11 PST 2002
>Last-Modified:  Thu Oct 31 15:08:11 PST 2002
>Originator:     Archie Cobbs
>Release:        FreeBSD 5.0-CURRENT sparc64
>Organization:
Packet Design
>Environment:
System: FreeBSD panther.freebsd.org 5.0-CURRENT FreeBSD 5.0-CURRENT #7: Tue Sep 17 18:14:25 PDT 2002 peter@panther.freebsd.org:/s/src/sys/sparc64/compile/PANTHER sparc64


>Description:

	The defintion of HUGE_VAL in <math.h> looks like this:

	    extern char __infinity[];
	    #define HUGE_VAL        (*(double *) __infinity)

	This causes compiler warnings when using -Wcast-align:

	    xx.c: In function `main':
	    xx.c:9: warning: cast increases required alignment of target type

	There is an additional problem: there are two versions of "math.h"
	in the FreeBSD tree:

		src/include/math.h
		src/lib/msun/src/math.h 

	Contrary to what you might think, src/include/math.h is NOT the
	one that gets installed into /usr/include during installation.

>How-To-Repeat:

	Logon to a sparc or alpha FreeBSD machine. Then do this:

	    $ cat > xx.c

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

	    int
	    main(int ac, char **av)
	    {
		    double x = 0;

		    printf("%d\n", x == HUGE_VAL);
		    return (0);
	    }
	    ^D
	    $ cc -Wcast-align -o xx xx.c

>Fix:

	I tried to fix this with these commits:

		http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/msun/src/math.h.diff?r1=1.14&r2=1.15
		http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/i386/gen/infinity.c.diff?r1=1.6&r2=1.7
		http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/alpha/gen/infinity.c.diff?r1=1.3&r2=1.4
		http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/ia64/gen/infinity.c.diff?r1=1.2&r2=1.3
		http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/sparc64/gen/infinity.c.diff?r1=1.3&r2=1.4

	but for some completely screwed reason, the libc compilation fails
	because of bogus #include paths, and I had to back out my commit.

	I have no idea how to fix this... why the heck are there two versions
	of math.h??

>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: archie 
State-Changed-When: Thu Oct 31 15:07:07 PST 2002 
State-Changed-Why:  
Fixed in -current by these revisions: 

/home/ncvs/src/lib/libc/alpha/gen/infinity.c,v  <--  infinity.c 
new revision: 1.6; previous revision: 1.5 
/home/ncvs/src/lib/libc/i386/gen/infinity.c,v  <--  infinity.c 
new revision: 1.9; previous revision: 1.8 
/home/ncvs/src/lib/libc/ia64/gen/infinity.c,v  <--  infinity.c 
new revision: 1.5; previous revision: 1.4 
/home/ncvs/src/lib/libc/sparc64/gen/infinity.c,v  <--  infinity.c 
new revision: 1.6; previous revision: 1.5 
/home/ncvs/src/lib/msun/src/math.h,v  <--  math.h 
new revision: 1.20; previous revision: 1.19 


http://www.freebsd.org/cgi/query-pr.cgi?pr=43544 
>Unformatted:
