[Bug target/61219] New: float to double conversion do not silence sNaN on soft-float ARM

aurelien at aurel32 dot net gcc-bugzilla@gcc.gnu.org
Sun May 18 21:22:00 GMT 2014


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

            Bug ID: 61219
           Summary: float to double conversion do not silence sNaN on
                    soft-float ARM
           Product: gcc
           Version: 4.10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aurelien at aurel32 dot net
              Host: armv5tejl-unknown-linux-gnueabi
            Target: armv5tejl-unknown-linux-gnueabi
             Build: armv5tejl-unknown-linux-gnueabi

Consider the following code:

#define _GNU_SOURCE
#include <stdio.h>
#include <math.h>

int main (void)
{
  float sNaN = __builtin_nansf ("");
  double x = (double) sNaN;
  return issignaling(x);
}

It returns 1 on soft-float ARM, but 0 on hard-float ARM or other architecture.
Quoting the IEEE Std 754 standard:

"Under default exception handling, any operation signaling an invalid operation
exception and for which a floating-point result is to be delivered shall
deliver a quiet NaN."

Given the soft float ARM code ignores exceptions and always provides a result,
a float to double conversion of a signaling NaN should return a quiet NaN. This
case is not handled in extendsfdf2.

This bug is basically present since the ARM EABI support has been added to GCC.

Patch will follow on the gcc-patches mailing list.



More information about the Gcc-bugs mailing list