summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2005-11-17 20:51:57 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2005-11-17 20:51:57 +0000
commit1f08543790370808c5c56534cbec3286199eba87 (patch)
tree86328546a4005d0cb9c97e184e758ae611020480 /lib
parente6d44b969f2712e50b7fff2dc6b7ab3d81fb7bb2 (diff)
Work around a gcc optimization problem. Spotted by biorn@; fix
inspired by FreeBSD. ok biorn@ millert@ deraadt@
Diffstat (limited to 'lib')
-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);