ToT build problem with nextafterl/nexttowardl (when using ToT GCC)
Steve Ellcey
sellcey@cavium.com
Fri Dec 8 21:12:00 GMT 2017
On Fri, 2017-12-08 at 12:01 -0800, Steve Ellcey wrote:
> On Fri, 2017-12-08 at 19:51 +0000, Szabolcs Nagy wrote:
> > looks like a gcc bug to me:
> >
> > an implementation may provide stricter guarantee (const)
> > than what the compiler assumes for the builtins (pure).
> >
> > (and i thought functions that may set errno are not pure)
> The program in question is being compiled with -fno-math-errno.
>
> Steve Ellcey
> sellcey@cavium.com
Actually it looks like the program is being compiled with
-fno-math-errno and -frounding-math. Â If you leave either ofÂ
these off GCC considers the function to be 'const' and the
declaration does not conflict with glibc. Â If you use both
arguments than GCC puts the pure attribute on the builtin
function and we get an error when we see the glibc function
delcaration that is always declared with the const attribute
in the glibc header file(s).
Test case:
extern long double nexttowardl (long double __x, long double __y) __attribute__Â
((__nothrow__ )) __attribute__ ((__const__));
This compiles fine unless BOTH -founding-math and -fno-math-errno
are used.
Do we want the glibc attribute of this function to vary based on
the GCC options?
Steve Ellcey
sellcey@cavium.com
More information about the Libc-alpha
mailing list