Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Sep 2010 21:35:07 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Renato Botelho <rbgarga@gmail.com>
Cc:        Roman Divacky <rdivacky@freebsd.org>, Derek Tattersall <dlt@mebtel.net>, current@freebsd.org
Subject:   Re: Clang now builds world and kernel, on i386 and amd64
Message-ID:  <4CA394EB.7090902@FreeBSD.org>
In-Reply-To: <AANLkTikPFi3gjXHGzq3hFBSBzA0j%2BWsOAHM-d8SYNWuD@mail.gmail.com>
References:  <4C99A53E.7060707@FreeBSD.org> <AANLkTimYj1VnVQBLROE94rqPYO7pQyHWfpjiYYZ2ORrX@mail.gmail.com> <AANLkTikm0FrJbOTiRPQhcqM30N-GyOYRBk_8jR-Gq9jF@mail.gmail.com> <20100929002843.GA5001@oriental.arm.org> <4CA2E00D.3080102@FreeBSD.org> <AANLkTik4k%2Bg8NGwRUp=7bvF2MiHhbBOHmA=Ree_-xRDT@mail.gmail.com> <4CA3244D.7030907@FreeBSD.org> <20100929155659.GA82433@oriental.arm.org> <20100929173158.GA73653@freebsd.org> <AANLkTi=6n0%2BEYsXT5aG_mjFmTK=fUYhwptvW%2Bn4zQMOK@mail.gmail.com> <20100929174434.GA75072@freebsd.org> <AANLkTikPFi3gjXHGzq3hFBSBzA0j%2BWsOAHM-d8SYNWuD@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------090609020204040609070302
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

On 2010-09-29 20:22, Renato Botelho wrote:
> It's using drand48() instead of rand()
...
> GCC libc:
> garga@botelhor:~/testes>  ./test
> random value 0.396465
>
> clang libc:
> garga@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?

--------------090609020204040609070302
Content-Type: text/plain;
 name="ldexp-amd64.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="ldexp-amd64.diff"

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

--------------090609020204040609070302--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4CA394EB.7090902>