diff options
author | Elliott Hughes <enh@google.com> | 2013-06-12 16:37:58 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2013-06-12 16:37:58 -0700 |
commit | 78419467a2f88744ae2445fca5eb442877ebb1b0 (patch) | |
tree | 1dd93ecd08e65e3de103194283b7a94e4a489504 /libm/upstream-freebsd/lib/msun/src/s_nearbyint.c | |
parent | 6a44d2271f372d0c65b05a5d3377bd00ce92824e (diff) | |
download | bionic-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.c | 6 |
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); \ |