summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormartynas <martynas@openbsd.org>2011-04-29 21:37:40 +0000
committermartynas <martynas@openbsd.org>2011-04-29 21:37:40 +0000
commit1241b6e5c944b6d49bc655963bfbca132ea279d8 (patch)
treea2887a6c62b837520038092dc83ac12c47270ba6
parentsorry, lousy fingers... typoed in the file while checking the diff (diff)
downloadwireguard-openbsd-1241b6e5c944b6d49bc655963bfbca132ea279d8.tar.xz
wireguard-openbsd-1241b6e5c944b6d49bc655963bfbca132ea279d8.zip
Trick GCC (-O2) into actually raising the underflow exception on m88k.
Since the second division operand is a power of two, non-zero, non-nan, this got optimized (-O2) into multiplication. As a result the underflow exception wasn't being raised properly. Make the second operand a volatile to prevent incorrect optimizations. OK miod@.
-rw-r--r--lib/libm/arch/m88k/fenv.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libm/arch/m88k/fenv.c b/lib/libm/arch/m88k/fenv.c
index 902914b9ade..e2aa8f989b2 100644
--- a/lib/libm/arch/m88k/fenv.c
+++ b/lib/libm/arch/m88k/fenv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fenv.c,v 1.2 2011/04/28 22:07:10 miod Exp $ */
+/* $OpenBSD: fenv.c,v 1.3 2011/04/29 21:37:40 martynas Exp $ */
/*
* Copyright (c) 2011 Martynas Venckus <martynas@openbsd.org>
@@ -109,8 +109,8 @@ feraiseexcept(int excepts)
d *= 2.0;
}
if (excepts & FE_UNDERFLOW) {
- d = 0x1p-1022;
- d /= 0x1p1023;
+ d = 0x1p1023;
+ d = 0x1p-1022 / d;
}
if (excepts & FE_INEXACT) {
d = 0x1p-1022;