[Bug target/113578] Incorrect sign printed for -nan on RISC-V

andrew at sifive dot com gcc-bugzilla@gcc.gnu.org
Mon May 13 22:36:06 GMT 2024


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113578

--- Comment #9 from Andrew Waterman <andrew at sifive dot com> ---
For my M1 running Ventura 13.6, NaN payloads _are_ propagated, sign bit
included. This test prints fffc0080:

int main()
{
  volatile long long ll = 0xffff801000000000;
  volatile double d;
  memcpy((char*)&d, (char*)&ll, sizeof(ll));

  volatile float f = d;
  volatile int i;
  memcpy((char*)&i, (char*)&f, sizeof(i));

  printf("%x\n", i);

  return 0;
}

So perhaps Apple has switched from default-NaN mode to NaN-propagating mode in
the time since that R blog post was written.


More information about the Gcc-bugs mailing list