diff options
author | 2005-11-17 20:51:56 +0000 | |
---|---|---|
committer | 2005-11-17 20:51:56 +0000 | |
commit | 8ba3194a5334ccbb27c3271efc1014993d90b75c (patch) | |
tree | c60249339c2a39ffe1b2e1b24a4118a54c4f0514 /lib/libm | |
parent | errx is better here (diff) | |
download | wireguard-openbsd-8ba3194a5334ccbb27c3271efc1014993d90b75c.tar.xz wireguard-openbsd-8ba3194a5334ccbb27c3271efc1014993d90b75c.zip |
Work around a gcc optimization problem. Spotted by biorn@; fix
inspired by FreeBSD. ok biorn@ millert@ deraadt@
Diffstat (limited to 'lib/libm')
-rw-r--r-- | lib/libm/src/lrintf.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libm/src/lrintf.c b/lib/libm/src/lrintf.c index 18027152ba4..2db9fa21342 100644 --- a/lib/libm/src/lrintf.c +++ b/lib/libm/src/lrintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lrintf.c,v 1.1 2005/11/17 20:07:40 otto Exp $ */ +/* $OpenBSD: lrintf.c,v 1.2 2005/11/17 20:51:56 otto Exp $ */ /* $NetBSD: lrintf.c,v 1.3 2004/10/13 15:18:32 drochner Exp $ */ /*- @@ -70,9 +70,11 @@ LRINTNAME(float x) /* >= 2^23 is already an exact integer */ if (e < SNG_FRACBITS) { + volatile float t = x; /* work around gcc problem */ /* round, using current direction */ - x += TWO23[s]; - x -= TWO23[s]; + t += TWO23[s]; + t -= TWO23[s]; + x = t; } GET_FLOAT_WORD(i0, x); |