summaryrefslogtreecommitdiffstats
path: root/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2013-06-12 16:37:58 -0700
committerElliott Hughes <enh@google.com>2013-06-12 16:37:58 -0700
commit78419467a2f88744ae2445fca5eb442877ebb1b0 (patch)
tree1dd93ecd08e65e3de103194283b7a94e4a489504 /libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
parent6a44d2271f372d0c65b05a5d3377bd00ce92824e (diff)
downloadbionic-78419467a2f88744ae2445fca5eb442877ebb1b0.zip
bionic-78419467a2f88744ae2445fca5eb442877ebb1b0.tar.gz
bionic-78419467a2f88744ae2445fca5eb442877ebb1b0.tar.bz2
Take upstream libm changes.
Mostly workarounds for GCC and Clang bugs. Change-Id: I4ef428a42d4ac6d622659053711a8cc416925727
Diffstat (limited to 'libm/upstream-freebsd/lib/msun/src/s_nearbyint.c')
-rw-r--r--libm/upstream-freebsd/lib/msun/src/s_nearbyint.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c b/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
index 12493d2..063f8d7 100644
--- a/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
+++ b/libm/upstream-freebsd/lib/msun/src/s_nearbyint.c
@@ -36,12 +36,16 @@ __FBSDID("$FreeBSD$");
* instead of feclearexcept()/feupdateenv() to restore the environment
* because the only exception defined for rint() is overflow, and
* rounding can't overflow as long as emax >= p.
+ *
+ * The volatile keyword is needed below because clang incorrectly assumes
+ * that rint won't raise any floating-point exceptions. Declaring ret volatile
+ * is sufficient to trick the compiler into doing the right thing.
*/
#define DECL(type, fn, rint) \
type \
fn(type x) \
{ \
- type ret; \
+ volatile type ret; \
fenv_t env; \
\
fegetenv(&env); \