clang is mostlikely miscompling libm

Steve Kargl sgk at troutmask.apl.washington.edu
Sun Mar 13 21:48:54 UTC 2016


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@

#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


More information about the freebsd-current mailing list