From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/8914 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: for information, gcc-4.2.3 miscompiles musl math Date: Sat, 21 Nov 2015 20:41:32 +0100 Message-ID: <20151121194132.GF23362@port70.net> References: <20151121172417.GU26951@example.net> <20151121192548.GD3818@brightrain.aerifal.cx> 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 1448134910 15963 80.91.229.3 (21 Nov 2015 19:41:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 21 Nov 2015 19:41:50 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-8927-gllmg-musl=m.gmane.org@lists.openwall.com Sat Nov 21 20:41:49 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 1a0E2c-00083m-SZ for gllmg-musl@m.gmane.org; Sat, 21 Nov 2015 20:41:46 +0100 Original-Received: (qmail 32235 invoked by uid 550); 21 Nov 2015 19:41:45 -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 32217 invoked from network); 21 Nov 2015 19:41:44 -0000 Mail-Followup-To: musl@lists.openwall.com Content-Disposition: inline In-Reply-To: <20151121192548.GD3818@brightrain.aerifal.cx> User-Agent: Mutt/1.5.24 (2015-08-30) Xref: news.gmane.org gmane.linux.lib.musl.general:8914 Archived-At: * Rich Felker [2015-11-21 14:25:48 -0500]: > On Sat, Nov 21, 2015 at 06:24:18PM +0100, u-uy74@aetey.se wrote: > > Good to be aware of: > > gcc-4.2.3 miscompiles musl math since at least 1.1.6, > > tested while targeting i486, > > 1.0.x seems to have been alright. > > > > The symptom is that sin(larger-than-2*pi) yields large values > > like "sin(8.000000) = 21.709544". > > Looks like the argument reduction logic has changed in a way > > which is not compatible with gcc-4.2.3. > > Are you using configure or a hand-written config.mak? configure sets > up a big hammer, -ffloat-store, when -fexcess-precision=standard is > not supported (i.e. on old gcc), which hopefully suffices to make this > code work, but it's possible it doesn't always do the job. > i think this change might be it: http://git.musl-libc.org/cgit/musl/commit/?id=0ce946cf808274c2d6e5419b139e130c8ad4bd30 the new code avoids an extra store, but then i rely on the evaluation being in long double. with -ffloat-store this breaks, adding extra store rounds at the wrong place. i didnt think about old toolchains when i made that change. this also affects rounding functions (but i386 has asm for most of them) i will think about it if i can change the code so it does not break with -ffloat-store. > > I do not notice any problems while compiling musl with gcc-5.2, nor > > have a compelling reason to insist on using gcc-4.2.3 (somebody else > > might have though, gcc-4.2.3 is the last one under gpl 2). > > I thought 4.2.1 was the last. > > If you don't want to look into it further yourself I'll see if someone > else interested in old toolchains can or try to get around to it > myself. I really don't want to introduce more hacks for these broken > compilers though. If people really still want to use them, we should > probably just find a cheap way to fix the compiler, like patching it > not to perform any optimizations whatsoever on floating point > expressions. > > Rich