This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Trouble with -pedantic and #include<cmath>, GCC or GLIBC bug?
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Volker Reichelt <reichelt at igpm dot rwth-aachen dot de>
- Cc: gcc at gcc dot gnu dot org, bug-glibc at gnu dot org, libc-alpha at sources dot redhat dot com
- Date: Tue, 12 Aug 2003 16:10:23 +0200
- Subject: Re: Trouble with -pedantic and #include<cmath>, GCC or GLIBC bug?
- References: <200308121532.h7CFWBaX023708@relay.rwth-aachen.de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Tue, Aug 12, 2003 at 05:32:24PM +0200, Volker Reichelt wrote:
> This is due to line 385 in GLIBC's mathinline.h:
>
> return __temp + __value ?: __x
>
> I'm using glibc 2.2.5, but the line is still present in glibc 2.3.2.
>
> Since omitting the middle term of a ?: expression is a gcc extension, it's
> a GCC bug. But since the ISO standard forbids it, it's a GLIBC bug. :-(
Red Hat glibc rpm includes this for some years (it makes no difference
on generated code).
Alternatively, __extension__ should be added to shut GCC up.
2000-05-22 Jakub Jelinek <jakub@redhat.com>
* sysdeps/i386/fpu/bits/mathinline.h (__expm1_code): Avoid using ?:
with omitted middle operand.
--- libc/sysdeps/i386/fpu/bits/mathinline.h 4 Jun 2003 22:17:35 -0000 1.1.1.13
+++ libc/sysdeps/i386/fpu/bits/mathinline.h 4 Jun 2003 22:22:36 -0000 1.11
@@ -381,7 +381,8 @@ __sincosl (long double __x, long double
("fscale # 2^int(x * log2(e))\n\t" \
: "=t" (__temp) : "0" (1.0), "u" (__exponent)); \
__temp -= 1.0; \
- return __temp + __value ?: __x
+ __temp += __value; \
+ return __temp ? __temp : __x
__inline_mathcodeNP_ (long double, __expm1l, __x, __expm1_code)
Jakub