Bug#304500: g++ -pendantic -ffast-math -O compile failure in <math.h>
Package: libc6-dev
Version: 2.3.2.ds1-20
The following program fails to compile, using gcc version 3.3.5 (Debian
1:3.3.5-8) using the noted flags:
// Compiling this g++ -c -pedantic -ffast-math -O gives errors due to an
// ?: operator in bits/mathinline.h.
#include <math.h>
The problem is a ?: operator that occurs in <bits/mathinline.h>. I
enclose a patch that fixes the bug.
Here are the compile error messages:
$ g++ -c -pedantic -ffast-math -O2 t.cc
In file included from /usr/include/math.h:362,
from t.cc:4:
/usr/include/bits/mathinline.h: In function `long double __expm1l(long double)
':
/usr/include/bits/mathinline.h:385: error: ISO C++ forbids omitting the middle
term of a ?: expression
/usr/include/bits/mathinline.h: In function `double expm1(double)':
/usr/include/bits/mathinline.h:536: error: ISO C++ forbids omitting the middle
term of a ?: expression
/usr/include/bits/mathinline.h: In function `float expm1f(float)':
/usr/include/bits/mathinline.h:536: error: ISO C++ forbids omitting the middle
term of a ?: expression
/usr/include/bits/mathinline.h: In function `long double expm1l(long double)':
/usr/include/bits/mathinline.h:536: error: ISO C++ forbids omitting the middle
term of a ?: expression
-Carl
--- /usr/include/bits/mathinline.h.bad 2004-12-26 21:18:35.000000000 -0500
+++ /usr/include/bits/mathinline.h 2005-04-13 12:24:20.149452016 -0400
@@ -381,7 +381,8 @@
("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)
Reply to: