summaryrefslogtreecommitdiffstats
path: root/lib/libm
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2005-11-17 20:51:56 +0000
committerotto <otto@openbsd.org>2005-11-17 20:51:56 +0000
commit8ba3194a5334ccbb27c3271efc1014993d90b75c (patch)
treec60249339c2a39ffe1b2e1b24a4118a54c4f0514 /lib/libm
parenterrx is better here (diff)
downloadwireguard-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.c8
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);