This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: ToT build problem with nextafterl/nexttowardl (when using ToT GCC)
- From: Steve Ellcey <sellcey at cavium dot com>
- To: Szabolcs Nagy <szabolcs dot nagy at arm dot com>, libc-alpha <libc-alpha at sourceware dot org>
- Cc: nd at arm dot com, Martin Sebor <msebor at gmail dot com>
- Date: Fri, 08 Dec 2017 13:11:52 -0800
- Subject: Re: ToT build problem with nextafterl/nexttowardl (when using ToT GCC)
- Authentication-results: sourceware.org; auth=none
- Authentication-results: spf=none (sender IP is ) smtp.mailfrom=Steve dot Ellcey at cavium dot com;
- References: <1512751903.23303.23.camel@cavium.com> <1512760947.23303.26.camel@cavium.com> <5A2AED2E.9000906@arm.com> <1512763297.23303.28.camel@cavium.com>
- Reply-to: sellcey at cavium dot com
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
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