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: [RFC Patch]: Implement remainder() as built-in function [PR fortran/24518]


On 10/24/06, Uros Bizjak <ubizjak@gmail.com> wrote:
On 10/24/06, Roger Sayle <roger@eyesopen.com> wrote:

> We should also think a little about Richard's suggestion of perhaps
> being more aggresive about ignoring errno when the language standards
> state that this isn't a strict requirement.  However, that should
> probably be a independent patch (perhaps with its own enhancement
> PR?), maybe even a new command line option, -fstrict-errno-math?.

Perhaps Richard's problem is specific to lrint (). At least in
manpages (which are not considered as an authoritative
documentation...) it is stated that lrint() _may_ set errno to EDOM,
but i.e. remainder() sets errno to EDOM for y=0.

It should be noted that glibc does not set EDOM when remainder()
returns NaN, where solaris libm does.

No, my problem is really a generic one. I wanted clarification on what -ferrno-math and -fno-errno-math really mean semantically and from an optimization point of view. Currently -fno-errno-math ignores errno completely and -ferrno-math tries to match the C library behavior by re-dispatching to it for setting errno (where possible - so, not for lrint for example). One problem is that gcc does currently not know how to access the errno location, so it has to dispatch to libc always for this.

I think the semantics of -fno-errno-math are fine, likewise -ferrno-math
(get libc behavior).  I would suggest making the default (not explicitly
specifying either one) using -fno-errno-math behavior for builtins the
standard does not require setting errno and -ferrno-math if it does.
Or maybe call that -fno-errno-math and -fstrict-errno-math, where
-ferrno-math -fno-strict-errno-math would be default.

Richard.


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