Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 29 May 2007 22:29:54 -0700 (PDT)
From:      Steve Kargl <sgk@troutmask.apl.washington.edu>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   standards/113147: frexpf in libm has C aliasing issues with gcc 4.2
Message-ID:  <200705300529.l4U5Ts3C008014@troutmask.apl.washington.edu>
Resent-Message-ID: <200705300540.l4U5e2hn086410@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         113147
>Category:       standards
>Synopsis:       frexpf in libm has C aliasing issues with gcc 4.2
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-standards
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 30 05:40:02 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Steve Kargl
>Release:        FreeBSD 7.0-CURRENT amd64
>Organization:
apl/uw
>Environment:
System: FreeBSD troutmask.apl.washington.edu 7.0-CURRENT FreeBSD 7.0-CURRENT #4: Thu Apr 19 12:32:30 PDT 2007 kargl@troutmask.apl.washington.edu:/usr/obj/usr/src/sys/SPEW amd64


	
>Description:

Currently, libm must be built with -fno-strict-aliasing due
to undefined behavior according to the C standard.  The
problem is is s_frexprf.c

>How-To-Repeat:

Build libm with -fstrict-aliasing in the CFLAGS.

>Fix:

(Watch for cut-&-paste tab corruption)

--- s_frexpf.c.orig     Sat May 26 16:26:50 2007
+++ s_frexpf.c  Mon May 28 17:55:48 2007
@@ -39,6 +39,6 @@
        }
        *eptr += (ix>>23)-126;
        hx = (hx&0x807fffff)|0x3f000000;
-       *(int*)&x = hx;
+       SET_FLOAT_WORD(x,hx);
        return x;
 }

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200705300529.l4U5Ts3C008014>