This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3] Change default to -fno-math-errno


On Thu, 21 Jun 2018, Jeff Law wrote:

> I think all this implies that the setting of -fno-math-errno by default
> really depends on the math library in use since it's the library that
> has to arrange for either errno to get set or for an exception to be raised.

If the library does not set errno, clearly -fno-math-errno by default is 
appropriate (and is the default on Darwin).

If the library does set errno, but the user doesn't care about the errno 
setting, -fno-math-errno is useful to that user; the question here is 
whether it's also an appropriate default to assume the user doesn't care 
about errno setting and so require them to pass -fmath-errno if they do.  
There are separate cases here for if the library does or does not set 
exceptions (the latter including most soft-float cases).

Then there are various built-in functions in GCC that use 
ATTR_MATHFN_FPROUNDING when they should use ATTR_MATHFN_FPROUNDING_ERRNO - 
because there are legitimate error cases for those functions for which 
errno setting is appropriate.  sin, cos, tan (domain errors for infinite 
arguments) are obvious examples.  (We have bug 64101 for erf, which is a 
case where the glibc model of when to set errno for underflow does *not* 
ever involve setting errno for this function, but some other 
implementations might have other models for when setting errno is 
appropriate.)

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]