Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MIPSEL][HPPA] Fix tests failing on quiet NaNs #6029

Merged
merged 1 commit into from
Jul 20, 2020
Merged

[MIPSEL][HPPA] Fix tests failing on quiet NaNs #6029

merged 1 commit into from
Jul 20, 2020

Conversation

basilgello
Copy link
Contributor

MIPSEL, MIPS64EL and HP-PA architectures have quiet and
signaling NaNs swapped. The test assumes correct values
for i386 / amd64 but obviously fails on these architectures.
It is documented in many places, like

https://software.llnl.gov/yorick-doc/stdlib/ieee.html :

Warning-- apparently there is no universal standard for what
constitutes signalling versus quiet NaN
on MIPS and HPPA architectures, qNaN and sNaN are reversed

https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html :

-mnan=2008
-mnan=legacy

These options control the encoding of the special
not-a-number (NaN) IEEE 754 floating-point data.

The -mnan=legacy option selects the legacy encoding.
In this case quiet NaNs (qNaNs) are denoted by the first
bit of their trailing significand field being 0, whereas
signaling NaNs (sNaNs) are denoted by the first bit of
their trailing significand field being 1.

The -mnan=2008 option selects the IEEE 754-2008 encoding.
In this case qNaNs are denoted by the first bit of their
trailing significand field being 1, whereas sNaNs are
denoted by the first bit of their trailing significand
field being 0.

The default is -mnan=legacy unless GCC has been configured
with --with-nan=2008.

The behavior mentioned above causes FTBFS in Debian starting
with 1.12.0:

https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mips64el&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830681&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mipsel&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594832647&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=hppa&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830726&raw=0

For HP-PA (PA-RISC) there is no way to override the reversal,
and for MIPSEL/MIPS64EL there is no macro defining the '-mnan'
choice, so both variants were added with OR boolean operator.

MIPSEL, MIPS64EL and HP-PA architectures have quiet and
signaling NaNs swapped. The test assumes correct values
for i386 / amd64 but obviously fails on these architectures.
It is documented in many places, like

https://software.llnl.gov/yorick-doc/stdlib/ieee.html :

Warning-- apparently there is no universal standard for what
  constitutes signalling versus quiet NaN
  on MIPS and HPPA architectures, qNaN and sNaN are reversed

https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html :

  -mnan=2008
  -mnan=legacy

  These options control the encoding of the special
  not-a-number (NaN) IEEE 754 floating-point data.

  The -mnan=legacy option selects the legacy encoding.
  In this case quiet NaNs (qNaNs) are denoted by the first
  bit of their trailing significand field being 0, whereas
  signaling NaNs (sNaNs) are denoted by the first bit of
  their trailing significand field being 1.

  The -mnan=2008 option selects the IEEE 754-2008 encoding.
  In this case qNaNs are denoted by the first bit of their
  trailing significand field being 1, whereas sNaNs are
  denoted by the first bit of their trailing significand
  field being 0.

  The default is -mnan=legacy unless GCC has been configured
  with --with-nan=2008.

The behavior mentioned above causes FTBFS in Debian starting
with 1.12.0:

https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mips64el&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830681&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mipsel&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594832647&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=hppa&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830726&raw=0

For HP-PA (PA-RISC) there is no way to override the reversal,
and for MIPSEL/MIPS64EL there is no macro defining the '-mnan'
choice, so both variants were added with OR boolean operator.

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
@basilgello
Copy link
Contributor Author

@aardappel @vglavnyy This issue was introduced in #5428 I tested the fix by building flatbuffers with GCC 8.3.0-4 mipsel and mips64el

@aardappel
Copy link
Collaborator

LGTM.. @vglavnyy ?

@vglavnyy
Copy link
Contributor

@basilgello Thank you for the fix.
Platform-independent floating-point code is a real pain even on x64 Win/Nix.
LGTM

@basilgello
Copy link
Contributor Author

@aardappel Please merge it then and please tag 1.12.1 release so I can get rid of ugly git prefixes in Debian :) Thanks!

@aardappel aardappel merged commit 2e48c8d into google:master Jul 20, 2020
@aardappel
Copy link
Collaborator

@basilgello I generally don't do releases for fixes unless its an absolute emergency (since it's a lot of work).

If you mean just adding a git tag.. I could, but that would confuse users of other languages/systems since there is no corresponding release.

I think living with uglyness is the easiest solution there :)

@basilgello
Copy link
Contributor Author

basilgello commented Jul 20, 2020 via email

ivannp pushed a commit to ivannp/flatbuffers that referenced this pull request Oct 2, 2020
…6029)

MIPSEL, MIPS64EL and HP-PA architectures have quiet and
signaling NaNs swapped. The test assumes correct values
for i386 / amd64 but obviously fails on these architectures.
It is documented in many places, like

https://software.llnl.gov/yorick-doc/stdlib/ieee.html :

Warning-- apparently there is no universal standard for what
  constitutes signalling versus quiet NaN
  on MIPS and HPPA architectures, qNaN and sNaN are reversed

https://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html :

  -mnan=2008
  -mnan=legacy

  These options control the encoding of the special
  not-a-number (NaN) IEEE 754 floating-point data.

  The -mnan=legacy option selects the legacy encoding.
  In this case quiet NaNs (qNaNs) are denoted by the first
  bit of their trailing significand field being 0, whereas
  signaling NaNs (sNaNs) are denoted by the first bit of
  their trailing significand field being 1.

  The -mnan=2008 option selects the IEEE 754-2008 encoding.
  In this case qNaNs are denoted by the first bit of their
  trailing significand field being 1, whereas sNaNs are
  denoted by the first bit of their trailing significand
  field being 0.

  The default is -mnan=legacy unless GCC has been configured
  with --with-nan=2008.

The behavior mentioned above causes FTBFS in Debian starting
with 1.12.0:

https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mips64el&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830681&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=mipsel&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594832647&raw=0
https://buildd.debian.org/status/fetch.php?pkg=flatbuffers&arch=hppa&ver=1.12.1%7Egit20200711.33e2d80%2Bdfsg1-0.1&stamp=1594830726&raw=0

For HP-PA (PA-RISC) there is no way to override the reversal,
and for MIPSEL/MIPS64EL there is no macro defining the '-mnan'
choice, so both variants were added with OR boolean operator.

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants