From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8923 Path: news.gmane.org!not-for-mail From: u-uy74@aetey.se Newsgroups: gmane.linux.lib.musl.general Subject: Re: for information, gcc-4.2.3 miscompiles musl math Date: Sat, 21 Nov 2015 21:32:45 +0100 Message-ID: <20151121203244.GZ26951@example.net> References: <20151121172417.GU26951@example.net> <20151121192548.GD3818@brightrain.aerifal.cx> <20151121194132.GF23362@port70.net> <20151121195144.GF3818@brightrain.aerifal.cx> <20151121200341.GH23362@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1448138010 1309 80.91.229.3 (21 Nov 2015 20:33:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Nov 2015 20:33:30 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8936-gllmg-musl=m.gmane.org@lists.openwall.com Sat Nov 21 21:33:29 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1a0Eqa-000526-Kr for gllmg-musl@m.gmane.org; Sat, 21 Nov 2015 21:33:24 +0100 Original-Received: (qmail 9828 invoked by uid 550); 21 Nov 2015 20:33:23 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 9807 invoked from network); 21 Nov 2015 20:33:23 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=fripost.org; h= in-reply-to:content-disposition:content-type:content-type :mime-version:references:message-id:subject:subject:from:from :date:date; s=20140703; t=1448137991; x=1449952392; bh=NHD0sKXmf xSteCIio8GHBJT0si4tdsv0Bf95qtjGz1Y=; b=gyfXWJBL4wLoQRhofZdFuTGBL 1KX9Jk4PTEEf8gao/8s0768BsuN1/SpVN3CkHjX509a9Tt6QDNFZBhtY71+N4gLK RO3XygKquLCaLzwdHvT686EA3EZvV3wY3hOnIVE/g7E4zRYeQ1Dm9nudQiupnkS0 OccvomxIQ1kiA/cE2I= X-Virus-Scanned: Debian amavisd-new at fripost.org Content-Disposition: inline In-Reply-To: <20151121200341.GH23362@port70.net> Xref: news.gmane.org gmane.linux.lib.musl.general:8923 Archived-At: On Sat, Nov 21, 2015 at 09:03:42PM +0100, Szabolcs Nagy wrote: > > Hmm, which places does it add the stores around? Could you fix it with > > an explicit conversion to double_t? That might be nice to harden > > against broken compilers without penalizing correct ones. > > yeah that might work > > i dont have gcc-4.2, can you try: > > diff --git a/src/math/__rem_pio2.c b/src/math/__rem_pio2.c > index a40db9f..d403f81 100644 > --- a/src/math/__rem_pio2.c > +++ b/src/math/__rem_pio2.c > @@ -118,7 +118,7 @@ int __rem_pio2(double x, double *y) > if (ix < 0x413921fb) { /* |x| ~< 2^20*(pi/2), medium size */ > medium: > /* rint(x/(pi/2)), Assume round-to-nearest. */ > - fn = x*invpio2 + toint - toint; > + fn = (double_t)x*invpio2 + toint - toint; > n = (int32_t)fn; > r = x - fn*pio2_1; > w = fn*pio2_1t; /* 1st round, good to 85 bits */ Sure, the result: sin(8.000000) = 0.989358 Which is the same as produced by musl-1.0.0+, without this patch, iow the expected "good" value. Thanks! Rune