svn commit: r223302 - head/lib/msun/src

Steve Kargl kargl at FreeBSD.org
Sun Jun 19 17:07:59 UTC 2011


Author: kargl
Date: Sun Jun 19 17:07:58 2011
New Revision: 223302
URL: http://svn.freebsd.org/changeset/base/223302

Log:
  In the libm access macros for the double type, z can sometimes
  be used uninitialized.  This can lead to spurious exceptions
  and bit clobbering.
  
  Submitted by:	bde
  Approved by:	das (mentor)

Modified:
  head/lib/msun/src/e_rem_pio2.c

Modified: head/lib/msun/src/e_rem_pio2.c
==============================================================================
--- head/lib/msun/src/e_rem_pio2.c	Sun Jun 19 17:02:42 2011	(r223301)
+++ head/lib/msun/src/e_rem_pio2.c	Sun Jun 19 17:07:58 2011	(r223302)
@@ -171,9 +171,8 @@ medium:
 	}
     /* set z = scalbn(|x|,ilogb(x)-23) */
 	GET_LOW_WORD(low,x);
-	SET_LOW_WORD(z,low);
 	e0 	= (ix>>20)-1046;	/* e0 = ilogb(z)-23; */
-	SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20)));
+	INSERT_WORDS(z, ix - ((int32_t)(e0<<20)), low);
 	for(i=0;i<2;i++) {
 		tx[i] = (double)((int32_t)(z));
 		z     = (z-tx[i])*two24;


More information about the svn-src-head mailing list