From: Stan Shebs Date: Tue, 23 Jan 2018 16:28:31 +0000 (-0800) Subject: Make zero volatile to defeat constant-folding of 0.0/0.0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=74926dde57d052737e2e2561b4e7fed5d0fe712f;p=thirdparty%2Fglibc.git Make zero volatile to defeat constant-folding of 0.0/0.0 --- diff --git a/sysdeps/ieee754/dbl-64/e_log.c b/sysdeps/ieee754/dbl-64/e_log.c index 6a18ebb904f..1558a2ec4e0 100644 --- a/sysdeps/ieee754/dbl-64/e_log.c +++ b/sysdeps/ieee754/dbl-64/e_log.c @@ -69,6 +69,8 @@ __ieee754_log (double x) number num; mp_no mpx, mpy, mpy1, mpy2, mperr; + volatile double zero = 0.0; + #include "ulog.tbl" #include "ulog.h" @@ -81,9 +83,9 @@ __ieee754_log (double x) if (__glibc_unlikely (ux < 0x00100000)) { if (__glibc_unlikely (((ux & 0x7fffffff) | dx) == 0)) - return MHALF / 0.0; /* return -INF */ + return MHALF / zero; /* return -INF */ if (__glibc_unlikely (ux < 0)) - return (x - x) / 0.0; /* return NaN */ + return (x - x) / zero; /* return NaN */ n -= 54; x *= two54.d; /* scale x */ num.d = x; diff --git a/sysdeps/ieee754/k_standard.c b/sysdeps/ieee754/k_standard.c index f74f9c712e9..f0436cc4a10 100644 --- a/sysdeps/ieee754/k_standard.c +++ b/sysdeps/ieee754/k_standard.c @@ -38,7 +38,7 @@ static char rcsid[] = "$NetBSD: k_standard.c,v 1.6 1995/05/10 20:46:35 jtc Exp $ # if 0 static const double zero = 0.0; /* used as const */ # else -static double zero = 0.0; /* used as const */ +volatile static double zero = 0.0; /* used as const */ # endif /*