diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2010-09-29 21:20:29 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2010-09-29 21:20:29 +0000 |
commit | 12894d9d668ffb31a6542e641c905913615bf78b (patch) | |
tree | ee54627ea7b0af7f277c30c880b8e1f6136dbf01 /lib/libc/amd64 | |
parent | 6854be25a8a7a3b946a19a97b4ea57430c49248f (diff) | |
download | src-12894d9d668ffb31a6542e641c905913615bf78b.tar.gz src-12894d9d668ffb31a6542e641c905913615bf78b.zip |
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)
Notes
Notes:
svn path=/head/; revision=213281
Diffstat (limited to 'lib/libc/amd64')
-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 43107fc297a8..ecf1ff8d4654 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 |