From: Szabolcs Nagy <szabolcs.nagy@arm.com>
To: Joseph Myers <joseph@codesourcery.com>
Cc: <nd@arm.com>, Wilco Dijkstra <Wilco.Dijkstra@arm.com>,
"libc-alpha@sourceware.org" <libc-alpha@sourceware.org>
Subject: Re: Improving math function wrappers
Date: Tue, 04 Apr 2017 17:25:00 -0000 [thread overview]
Message-ID: <58E3D6EE.6020601@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.20.1703161816370.18031@digraph.polyomino.org.uk>
On 16/03/17 18:24, Joseph Myers wrote:
> On Thu, 16 Mar 2017, Szabolcs Nagy wrote:
>> On 16/03/17 14:29, Joseph Myers wrote:
>>> On Thu, 16 Mar 2017, Wilco Dijkstra wrote:
>>>
>>>> Given other languages don't even have the concept of errno, C99 doesn't
>>>> require it, and no application ever reads errno, it is inefficient to
>>>> force the use of the wrappers in almost all cases.
>>>
>>> C99 not requiring it was an incompatible quiet change from C90.
>>
>> i think glibc only has to set errno when user code is
>> compiled with c89 compatibility and even then only for
>> math functions that were defined in c89 and then only
>> guarantee correct errno setting in default rounding mode
>> (c89 code cannot access the fenv).
>
> Incompatible quiet change means a good idea to implement the compatible
> mode ((math_errhandling & MATH_ERRNO) != 0) as far as possible. Just like
> it's a good idea to avoid size_t wider than unsigned long.
i think this would be a valid argument if
(math_errhandling & MATH_ERRNO) != 0
was the only way to get backward compatibility,
but that's not the case: errno can be clobbered
any time and thus c89 backward compatibility can
be maintained with
(math_errhandling & MATH_ERRNO) == 0
in which case there is no requirement for non-c89
math functions to set errno (or getting errno
right in non-default fenv) and thus the wrapper
can be removed from all single and long double
precision functions (and kept for double prec
c89 functions if glibc cares about compatibility).
> Compilers for non-C languages without the concept of these functions
> setting errno can of course default to -fno-math-errno by default (and
> built-in no-errno functions that can be used with -fmath-errno is
> otherwise enabled would also be desirable for fma, sqrt, etc.).
then fortran can only use no-errno functions
when those can be inlined, since extern calls
use the standard libc symbols which set errno
in glibc.
next prev parent reply other threads:[~2017-04-04 17:25 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <AM5PR0802MB2610AA7EDC518B39F6D7152683260@AM5PR0802MB2610.eurprd08.prod.outlook.com>
2017-03-16 13:53 ` Wilco Dijkstra
2017-03-16 14:39 ` Joseph Myers
2017-03-16 14:41 ` Joseph Myers
2017-03-16 18:07 ` Szabolcs Nagy
2017-03-16 18:24 ` Joseph Myers
2017-04-04 17:25 ` Szabolcs Nagy [this message]
2017-04-04 17:34 ` Joseph Myers
2017-04-07 15:54 ` Szabolcs Nagy
2017-04-04 17:41 ` Zack Weinberg
2017-03-16 21:22 ` Florian Weimer
2017-03-16 21:36 ` Joseph Myers
2017-03-16 22:49 ` Wilco Dijkstra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=58E3D6EE.6020601@arm.com \
--to=szabolcs.nagy@arm.com \
--cc=Wilco.Dijkstra@arm.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=nd@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).