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

--- Comment #6 from Xi Ruoyao <xry111 at gcc dot gnu.org> ---
(In reply to Andrew Waterman from comment #5)
> My recollection is that Annex F leaves signaling NaN behavior
> implementation-defined, and so setting the invalid flag on signaling NaN is
> permitted but not required.

It is required by Glibc manual:

 -- Macro: int FE_SNANS_ALWAYS_SIGNAL

     This macro, defined by TS 18661-1:2014, is defined to ‘1’ in
     ‘fenv.h’ to indicate that functions and operations with signaling
     NaN inputs and floating-point results always raise the invalid
     exception and return a quiet NaN, even in cases (such as ‘fmax’,
     ‘hypot’ and ‘pow’) where a quiet NaN input can produce a non-NaN
     result.  Because some compiler optimizations may not handle
     signaling NaNs correctly, this macro is only defined if compiler
     support for signaling NaNs is enabled.  That support can be enabled
     with the GCC option ‘-fsignaling-nans’.

Thus the RISC-V implementation needs to raise it unless you announce
-fsignaling-nans completely unsupported on RISC-V.

Reply via email to