Author: dim
Date: Wed Sep 29 21:20:29 2010
New Revision: 213281
URL: http://svn.freebsd.org/changeset/base/213281
Log:
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)
Modified:
head/lib/libc/amd64/gen/ldexp.c
Modified: head/lib/libc/amd64/gen/ldexp.c
==============================================================================
--- head/lib/libc/amd64/gen/ldexp.c Wed Sep 29 21:19:25 2010
(r213280)
+++ head/lib/libc/amd64/gen/ldexp.c Wed Sep 29 21:20:29 2010
(r213281)
@@ -36,6 +36,8 @@ static char sccsid[] = "@(#)ldexp.c 8.1
#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
_______________________________________________
[email protected] mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"