This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Improve math_errhandling
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Wilco Dijkstra <Wilco dot Dijkstra at arm dot com>
- Cc: "libc-alpha at sourceware dot org" <libc-alpha at sourceware dot org>, nd <nd at arm dot com>
- Date: Wed, 8 Nov 2017 16:47:32 +0000
- Subject: Re: [PATCH] Improve math_errhandling
- Authentication-results: sourceware.org; auth=none
- References: <HE1PR0801MB2058FC670374E87D486379C783560@HE1PR0801MB2058.eurprd08.prod.outlook.com>
On Wed, 8 Nov 2017, Wilco Dijkstra wrote:
> This is based on discussion in https://gcc.gnu.org/ml/gcc-patches/2017-10/msg02096.html.
>
> Currently math_errhandling is always set to MATH_ERRNO | MATH_ERREXCEPT
> even if -fno-math-errno is used. It is not defined at all when fast-math
> is used, eventhough the GLIBC implementation always supports exceptions
> (on hardware floating point implementations). Improve this to take
> __NO_MATH_ERRNO__ into account and update comment.
Some bits/mathinline.h implementations might not produce appropriate
exceptions with -ffast-math. Likewise versions inlined by GCC.
The header definitely needs to check for __FAST_MATH__. There is a case
for defining math_errhandling to 0 in the __FAST_MATH__ case (a
nonconforming value, but -ffast-math is a nonconforming mode, and 0
accurately reflects the situation that neither errno nor exceptions can be
relied upon in that case) rather than the existing state of being
undefined (also nonconforming). Note that GCC versions before GCC 5 don't
define __NO_MATH_ERRNO__ at all.
--
Joseph S. Myers
joseph@codesourcery.com