standards/113147: frexpf in libm has C aliasing issues with gcc 4.2

Steve Kargl sgk at troutmask.apl.washington.edu
Wed May 30 05:40:02 UTC 2007


>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 at 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:


More information about the freebsd-standards mailing list