Re: HEADSUP: math is broken with clang and optimization

From: Steve Kargl <sgk_at_troutmask.apl.washington.edu>
Date: Mon, 15 Feb 2021 14:13:47 -0800
On Mon, Feb 15, 2021 at 01:03:36PM -0800, Steve Kargl wrote:
> On Mon, Feb 15, 2021 at 12:49:13PM -0800, Steve Kargl wrote:
> > On Sun, Feb 14, 2021 at 01:59:58PM -0800, Steve Kargl wrote:
> > > Just a headsup for anyone doing numerical work with
> > > FreeBSD-current.  clang with optimization of -O1 or
> > > higher produces wrong results.  Testing 1 million 
> > > complex values of ccoshf and limiting |z| < 20,
> > > shows
> > > 
> > 
> > This is either an in-ling bug or discarding a cast issue.
> > With everything in the same file so clang has dp_ccosh
> > available to it when compiling main.
> > 
> 
> Code builds and works as expected with gcc 10.2and
> gcc 11.0.0.
> 

Can't find a list of options that is equivalent to -O1,
so cannot test various optimizations.

Notice that -march=i686 gives the wrong results and
-march=core2 gives the correct result.  Trying -march=i686
-msse -msse2 gives the correct result.  It seems that
clang does not understand how the x87 (on i585-freebsd).

-- 
Steve
Received on Mon Feb 15 2021 - 21:13:58 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:27 UTC