diff options
author | dim <dim@FreeBSD.org> | 2010-09-29 21:20:29 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2010-09-29 21:20:29 +0000 |
commit | e63f3dc97af9bfe7754f93fcde7246db0f31e89b (patch) | |
tree | ee54627ea7b0af7f277c30c880b8e1f6136dbf01 /lib/libc | |
parent | bec33718ece30f08154dfc53ea8936f0f2115d86 (diff) | |
download | FreeBSD-src-e63f3dc97af9bfe7754f93fcde7246db0f31e89b.zip FreeBSD-src-e63f3dc97af9bfe7754f93fcde7246db0f31e89b.tar.gz |
Apply the same workaround for clang to amd64's version of ldexp.c (as in
r212976): order the incoming arguments to fscale as st(0), st(1), and
mark temp2 volatile (only in case of compilation with clang) to force
clang to pop it correctly. No binary change when compiled with gcc.
This fixes ldexp() when compiled with clang on amd64, which makes
drand48() and friends work correctly again, and this in turn fixes
perl's tempfile().
Reported by: Renato Botelho, Derek Tattersall
Approved by: rpaulo (mentor)
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/amd64/gen/ldexp.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libc/amd64/gen/ldexp.c b/lib/libc/amd64/gen/ldexp.c index 43107fc..ecf1ff8 100644 --- a/lib/libc/amd64/gen/ldexp.c +++ b/lib/libc/amd64/gen/ldexp.c @@ -36,6 +36,8 @@ static char sccsid[] = "@(#)ldexp.c 8.1 (Berkeley) 6/4/93"; #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include <math.h> + /* * ldexp(value, exp): return value * (2 ** exp). * @@ -49,12 +51,16 @@ __FBSDID("$FreeBSD$"); double ldexp (double value, int exp) { - double temp, texp, temp2; + double temp, texp; +#ifdef __clang__ + volatile +#endif + double temp2; texp = exp; #ifdef __GNUC__ __asm ("fscale " - : "=u" (temp2), "=t" (temp) - : "0" (texp), "1" (value)); + : "=t" (temp), "=u" (temp2) + : "0" (value), "1" (texp)); #else #error unknown asm #endif |