Re: clang is mostlikely miscompling libm

From: Steve Kargl <sgk_at_troutmask.apl.washington.edu>
Date: Sun, 13 Mar 2016 14:48:52 -0700
On Sun, Mar 13, 2016 at 09:08:56PM +0000, Ed Maste wrote:
> On 13 March 2016 at 19:16, Steve Kargl <sgk_at_troutmask.apl.washington.edu> wrote:
> > JFYI,
> >
> > It appears that clang on up-to-date current may be
> > miscompiling libm on at i686 class hardware.
> 
> Do you have an example of the suspected miscompilation?

See freebsd-toolchain_at_

#include <fenv.h>
#include <stdio.h>

int
main(void)
{
   int i;
//   float x = 1.f;
   double x = 1.;
   i = 0;
   feclearexcept(FE_ALL_EXCEPT);
   do {
      x *= 2;
      i++;
   } while(!fetestexcept(FE_OVERFLOW));
   if (fetestexcept(FE_OVERFLOW)) printf("FE_UNDERFLOW: ");
   printf("x = %e after %d iterations\n", x, i);

   return 0;
}


-- 
Steve
Received on Sun Mar 13 2016 - 20:48:54 UTC

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