From owner-svn-src-head@FreeBSD.ORG Wed Sep 29 21:20:30 2010 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A93510656A6; Wed, 29 Sep 2010 21:20:30 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1A4B68FC1D; Wed, 29 Sep 2010 21:20:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8TLKTFI022161; Wed, 29 Sep 2010 21:20:29 GMT (envelope-from dim@svn.freebsd.org) Received: (from dim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8TLKTSf022159; Wed, 29 Sep 2010 21:20:29 GMT (envelope-from dim@svn.freebsd.org) Message-Id: <201009292120.o8TLKTSf022159@svn.freebsd.org> From: Dimitry Andric Date: Wed, 29 Sep 2010 21:20:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r213281 - head/lib/libc/amd64/gen X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Sep 2010 21:20:30 -0000 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 __FBSDID("$FreeBSD$"); +#include + /* * 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