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

Steve Kargl kargl at FreeBSD.org
Sat Aug 30 17:14:47 UTC 2014


Author: kargl
Date: Sat Aug 30 17:14:47 2014
New Revision: 270845
URL: http://svnweb.freebsd.org/changeset/base/270845

Log:
  Make tiny volatile to prevent the compiler(s) from
  constant folding expressions of the form "1 - tiny",
  which are used to raise FE_INEXACT.

Modified:
  head/lib/msun/src/s_tanh.c
  head/lib/msun/src/s_tanhf.c

Modified: head/lib/msun/src/s_tanh.c
==============================================================================
--- head/lib/msun/src/s_tanh.c	Sat Aug 30 15:41:07 2014	(r270844)
+++ head/lib/msun/src/s_tanh.c	Sat Aug 30 17:14:47 2014	(r270845)
@@ -42,7 +42,8 @@ __FBSDID("$FreeBSD$");
 #include "math.h"
 #include "math_private.h"
 
-static const double one = 1.0, two = 2.0, tiny = 1.0e-300, huge = 1.0e300;
+static volatile const double tiny = 1.0e-300;
+static const double one = 1.0, two = 2.0, huge = 1.0e300;
 
 double
 tanh(double x)

Modified: head/lib/msun/src/s_tanhf.c
==============================================================================
--- head/lib/msun/src/s_tanhf.c	Sat Aug 30 15:41:07 2014	(r270844)
+++ head/lib/msun/src/s_tanhf.c	Sat Aug 30 17:14:47 2014	(r270845)
@@ -19,7 +19,9 @@ __FBSDID("$FreeBSD$");
 #include "math.h"
 #include "math_private.h"
 
-static const float one=1.0, two=2.0, tiny = 1.0e-30, huge = 1.0e30;
+static volatile const float tiny = 1.0e-30;
+static const float one=1.0, two=2.0, huge = 1.0e30;
+
 float
 tanhf(float x)
 {


More information about the svn-src-all mailing list