On 2010-09-29 20:22, Renato Botelho wrote:
It's using drand48() instead of rand()
...
GCC libc:
ga...@botelhor:~/testes>  ./test
random value 0.396465

clang libc:
ga...@botelhor:~/testes>  ./test
random value -inf

Renato, Derek, could you please apply the attached patch for ldexp,
rebuild your libc (with clang), and run your random test program again?
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
_______________________________________________
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Reply via email to