With TCC mob on aarch64, the double to long double conversion
is buggy on subnormal values. This makes a MPFR test fail
(reported by Christian Jullien).

Testcase:

#include <stdio.h>

int main (void)
{
  volatile double d = 0x0.88p-1022;  /* subnormal */
  printf ("d = %a\n", d);
  printf ("d = %.40g\n", d);
  volatile long double x = d;
  printf ("x = %La\n", x);
  printf ("x = %.40Lg\n", x);
  return 0;
}

With GCC (correct):

d = 0x0.88p-1022
d = 1.182070487331950734766686131082839659116e-308
x = 0x1.1p-1023
x = 1.182070487331950734766686131082839659116e-308

With TCC (incorrect):

d = 0x0.88p-1022
d = 1.182070487331950734766686131082839659116e-308
x = 0x1.88p-1023
x = 1.703572172919576058928459424207621861668e-308

I suspect that the code adds the usual implicit bit 1, but there is
no such bit with subnormals.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

_______________________________________________
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to