On Mon, 30 Oct 2017, Richard Biener wrote:

> On Fri, Oct 27, 2017 at 6:28 PM, Joseph Myers <jos...@codesourcery.com> wrote:
> > No existing glibc version defines math_errhandling based on
> > __NO_MATH_ERRNO__.  I'd expect such a change to come with a glibc patch,
> > and indeed a GCC execution test of the value of math_errhandling to make
> > sure the compiler's behavior isn't contradicting what's declared by the
> > runtime libraries.  Also, the default should not be changed for pre-C99 C
> > standard modes (or pre-C++11 C++, I suppose).
> 
> Should we also get the __ieee764_ entries used if the compiler sets
> __NO_MATH_ERRNO__?  That is, if the librari advertises not setting errno
> via math_errhandling is it still allowed to set/clobber errno anyways?

See C11 7.12.1p7.  "If a domain, pole, or range error occurs and the 
integer expression math_errhandling & MATH_ERRNO is zero, then errno shall 
either be set to the value corresponding to the error or left unmodified. 
If no such error occurs, errno shall be left unmodified regardless of the 
setting of math_errhandling.".  (And, for <complex.h> functions, "An 
implementation may set errno but is not required to.".)

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to