This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: ToT build problem with nextafterl/nexttowardl (when using ToT GCC)


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


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