From owner-svn-src-all@FreeBSD.ORG Fri Oct 21 06:26:39 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 24FC3106564A; Fri, 21 Oct 2011 06:26:39 +0000 (UTC) (envelope-from das@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 145228FC16; Fri, 21 Oct 2011 06:26:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p9L6QcPR009708; Fri, 21 Oct 2011 06:26:38 GMT (envelope-from das@svn.freebsd.org) Received: (from das@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9L6QcEG009703; Fri, 21 Oct 2011 06:26:38 GMT (envelope-from das@svn.freebsd.org) Message-Id: <201110210626.p9L6QcEG009703@svn.freebsd.org> From: David Schultz Date: Fri, 21 Oct 2011 06:26:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226596 - head/lib/msun/src X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Oct 2011 06:26:39 -0000 Author: das Date: Fri Oct 21 06:26:38 2011 New Revision: 226596 URL: http://svn.freebsd.org/changeset/base/226596 Log: Use STRICT_ASSIGN() to ensure that the compiler doesn't screw things up by storing x in a wider type than it's supposed to. Submitted by: bde Modified: head/lib/msun/src/e_exp.c head/lib/msun/src/e_expf.c head/lib/msun/src/s_expm1.c head/lib/msun/src/s_expm1f.c Modified: head/lib/msun/src/e_exp.c ============================================================================== --- head/lib/msun/src/e_exp.c Fri Oct 21 06:26:07 2011 (r226595) +++ head/lib/msun/src/e_exp.c Fri Oct 21 06:26:38 2011 (r226596) @@ -76,6 +76,8 @@ __FBSDID("$FreeBSD$"); * to produce the hexadecimal values shown. */ +#include + #include "math.h" #include "math_private.h" @@ -133,7 +135,7 @@ __ieee754_exp(double x) /* default IEEE hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */ lo = t*ln2LO[0]; } - x = hi - lo; + STRICT_ASSIGN(double, x, hi - lo); } else if(hx < 0x3e300000) { /* when |x|<2**-28 */ if(huge+x>one) return one+x;/* trigger inexact */ Modified: head/lib/msun/src/e_expf.c ============================================================================== --- head/lib/msun/src/e_expf.c Fri Oct 21 06:26:07 2011 (r226595) +++ head/lib/msun/src/e_expf.c Fri Oct 21 06:26:38 2011 (r226596) @@ -16,6 +16,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "math.h" #include "math_private.h" @@ -40,7 +42,7 @@ P2 = -2.7667332906e-3; /* -0xb55215.0p- static volatile float twom100 = 7.8886090522e-31; /* 2**-100=0x0d800000 */ float -__ieee754_expf(float x) /* default IEEE double exp */ +__ieee754_expf(float x) { float y,hi=0.0,lo=0.0,c,t,twopk; int32_t k=0,xsb; @@ -70,7 +72,7 @@ __ieee754_expf(float x) /* default IEEE hi = x - t*ln2HI[0]; /* t*ln2HI is exact here */ lo = t*ln2LO[0]; } - x = hi - lo; + STRICT_ASSIGN(float, x, hi - lo); } else if(hx < 0x39000000) { /* when |x|<2**-14 */ if(huge+x>one) return one+x;/* trigger inexact */ Modified: head/lib/msun/src/s_expm1.c ============================================================================== --- head/lib/msun/src/s_expm1.c Fri Oct 21 06:26:07 2011 (r226595) +++ head/lib/msun/src/s_expm1.c Fri Oct 21 06:26:38 2011 (r226596) @@ -108,6 +108,8 @@ __FBSDID("$FreeBSD$"); * to produce the hexadecimal values shown. */ +#include + #include "math.h" #include "math_private.h" @@ -168,7 +170,7 @@ expm1(double x) hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ lo = t*ln2_lo; } - x = hi - lo; + STRICT_ASSIGN(double, x, hi - lo); c = (hi-x)-lo; } else if(hx < 0x3c900000) { /* when |x|<2**-54, return x */ Modified: head/lib/msun/src/s_expm1f.c ============================================================================== --- head/lib/msun/src/s_expm1f.c Fri Oct 21 06:26:07 2011 (r226595) +++ head/lib/msun/src/s_expm1f.c Fri Oct 21 06:26:38 2011 (r226596) @@ -16,6 +16,8 @@ #include __FBSDID("$FreeBSD$"); +#include + #include "math.h" #include "math_private.h" @@ -74,7 +76,7 @@ expm1f(float x) hi = x - t*ln2_hi; /* t*ln2_hi is exact here */ lo = t*ln2_lo; } - x = hi - lo; + STRICT_ASSIGN(float, x, hi - lo); c = (hi-x)-lo; } else if(hx < 0x33000000) { /* when |x|<2**-25, return x */