http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52308
Bug #: 52308 Summary: -pedantic -ffast-math fails to compile with <cmath> Classification: Unclassified Product: gcc Version: 4.6.2 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: deusexsophism...@gmail.com [david@david-desktop ~]$ g++ -v Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/4.6.2/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,objc,obj-c++,java,fortran,ada,go,lto --enable-plugin --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux Thread model: posix gcc version 4.6.2 20111027 (Red Hat 4.6.2-1) (GCC) The following program fails to compile if given the flags -ffast-math -pedantic. #include <cmath> int main () { return 0; } [david@david-desktop ~]$ g++ test.cpp -pedantic -ffast-math In file included from /usr/include/math.h:423:0, from /usr/lib/gcc/x86_64-redhat-linux/4.6.2/../../../../include/c++/4.6.2/cmath:46, from test.cpp:1: /usr/include/bits/math-finite.h:25:53: error: declaration of ‘double acos(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:55:1: error: from previous declaration ‘double acos(double) throw ()’ /usr/include/bits/math-finite.h:26:53: error: declaration of ‘float acosf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:55:1: error: from previous declaration ‘float acosf(float) throw ()’ /usr/include/bits/math-finite.h:28:65: error: declaration of ‘long double acosl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:55:1: error: from previous declaration ‘long double acosl(long double) throw ()’ /usr/include/bits/math-finite.h:33:55: error: declaration of ‘double acosh(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:89:1: error: from previous declaration ‘double acosh(double) throw ()’ /usr/include/bits/math-finite.h:34:55: error: declaration of ‘float acoshf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:89:1: error: from previous declaration ‘float acoshf(float) throw ()’ /usr/include/bits/math-finite.h:36:67: error: declaration of ‘long double acoshl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:89:1: error: from previous declaration ‘long double acoshl(long double) throw ()’ /usr/include/bits/math-finite.h:41:53: error: declaration of ‘double asin(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:57:1: error: from previous declaration ‘double asin(double) throw ()’ /usr/include/bits/math-finite.h:42:53: error: declaration of ‘float asinf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:57:1: error: from previous declaration ‘float asinf(float) throw ()’ /usr/include/bits/math-finite.h:44:65: error: declaration of ‘long double asinl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:57:1: error: from previous declaration ‘long double asinl(long double) throw ()’ /usr/include/bits/math-finite.h:48:63: error: declaration of ‘double atan2(double, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:61:1: error: from previous declaration ‘double atan2(double, double) throw ()’ /usr/include/bits/math-finite.h:49:62: error: declaration of ‘float atan2f(float, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:61:1: error: from previous declaration ‘float atan2f(float, float) throw ()’ /usr/include/bits/math-finite.h:51:80: error: declaration of ‘long double atan2l(long double, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:61:1: error: from previous declaration ‘long double atan2l(long double, long double) throw ()’ /usr/include/bits/math-finite.h:56:55: error: declaration of ‘double atanh(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:93:1: error: from previous declaration ‘double atanh(double) throw ()’ /usr/include/bits/math-finite.h:57:55: error: declaration of ‘float atanhf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:93:1: error: from previous declaration ‘float atanhf(float) throw ()’ /usr/include/bits/math-finite.h:59:67: error: declaration of ‘long double atanhl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:93:1: error: from previous declaration ‘long double atanhl(long double) throw ()’ /usr/include/bits/math-finite.h:64:53: error: declaration of ‘double cosh(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:73:1: error: from previous declaration ‘double cosh(double) throw ()’ /usr/include/bits/math-finite.h:65:53: error: declaration of ‘float coshf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:73:1: error: from previous declaration ‘float coshf(float) throw ()’ /usr/include/bits/math-finite.h:67:65: error: declaration of ‘long double coshl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:73:1: error: from previous declaration ‘long double coshl(long double) throw ()’ /usr/include/bits/math-finite.h:71:51: error: declaration of ‘double exp(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:101:1: error: from previous declaration ‘double exp(double) throw ()’ /usr/include/bits/math-finite.h:72:51: error: declaration of ‘float expf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:101:1: error: from previous declaration ‘float expf(float) throw ()’ /usr/include/bits/math-finite.h:74:63: error: declaration of ‘long double expl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:101:1: error: from previous declaration ‘long double expl(long double) throw ()’ /usr/include/bits/math-finite.h:79:55: error: declaration of ‘double exp10(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:122:1: error: from previous declaration ‘double exp10(double) throw ()’ /usr/include/bits/math-finite.h:80:55: error: declaration of ‘float exp10f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:122:1: error: from previous declaration ‘float exp10f(float) throw ()’ /usr/include/bits/math-finite.h:82:67: error: declaration of ‘long double exp10l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:122:1: error: from previous declaration ‘long double exp10l(long double) throw ()’ /usr/include/bits/math-finite.h:86:55: error: declaration of ‘double pow10(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:124:1: error: from previous declaration ‘double pow10(double) throw ()’ /usr/include/bits/math-finite.h:87:55: error: declaration of ‘float pow10f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:124:1: error: from previous declaration ‘float pow10f(float) throw ()’ /usr/include/bits/math-finite.h:89:67: error: declaration of ‘long double pow10l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:124:1: error: from previous declaration ‘long double pow10l(long double) throw ()’ /usr/include/bits/math-finite.h:95:53: error: declaration of ‘double exp2(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:143:1: error: from previous declaration ‘double exp2(double) throw ()’ /usr/include/bits/math-finite.h:96:53: error: declaration of ‘float exp2f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:143:1: error: from previous declaration ‘float exp2f(float) throw ()’ /usr/include/bits/math-finite.h:98:65: error: declaration of ‘long double exp2l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:143:1: error: from previous declaration ‘long double exp2l(long double) throw ()’ /usr/include/bits/math-finite.h:103:61: error: declaration of ‘double fmod(double, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:189:1: error: from previous declaration ‘double fmod(double, double) throw ()’ /usr/include/bits/math-finite.h:104:60: error: declaration of ‘float fmodf(float, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:189:1: error: from previous declaration ‘float fmodf(float, float) throw ()’ /usr/include/bits/math-finite.h:106:78: error: declaration of ‘long double fmodl(long double, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:189:1: error: from previous declaration ‘long double fmodl(long double, long double) throw ()’ /usr/include/bits/math-finite.h:111:63: error: declaration of ‘double hypot(double, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:164:1: error: from previous declaration ‘double hypot(double, double) throw ()’ /usr/include/bits/math-finite.h:112:62: error: declaration of ‘float hypotf(float, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:164:1: error: from previous declaration ‘float hypotf(float, float) throw ()’ /usr/include/bits/math-finite.h:114:80: error: declaration of ‘long double hypotl(long double, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:164:1: error: from previous declaration ‘long double hypotl(long double, long double) throw ()’ /usr/include/bits/math-finite.h:120:49: error: declaration of ‘double j0(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:239:1: error: from previous declaration ‘double j0(double) throw ()’ /usr/include/bits/math-finite.h:121:49: error: declaration of ‘float j0f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:239:1: error: from previous declaration ‘float j0f(float) throw ()’ /usr/include/bits/math-finite.h:123:61: error: declaration of ‘long double j0l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:239:1: error: from previous declaration ‘long double j0l(long double) throw ()’ /usr/include/bits/math-finite.h:127:49: error: declaration of ‘double y0(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:242:1: error: from previous declaration ‘double y0(double) throw ()’ /usr/include/bits/math-finite.h:128:49: error: declaration of ‘float y0f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:242:1: error: from previous declaration ‘float y0f(float) throw ()’ /usr/include/bits/math-finite.h:130:61: error: declaration of ‘long double y0l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:242:1: error: from previous declaration ‘long double y0l(long double) throw ()’ /usr/include/bits/math-finite.h:134:49: error: declaration of ‘double j1(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:240:1: error: from previous declaration ‘double j1(double) throw ()’ /usr/include/bits/math-finite.h:135:49: error: declaration of ‘float j1f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:240:1: error: from previous declaration ‘float j1f(float) throw ()’ /usr/include/bits/math-finite.h:137:61: error: declaration of ‘long double j1l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:240:1: error: from previous declaration ‘long double j1l(long double) throw ()’ /usr/include/bits/math-finite.h:141:49: error: declaration of ‘double y1(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:243:1: error: from previous declaration ‘double y1(double) throw ()’ /usr/include/bits/math-finite.h:142:49: error: declaration of ‘float y1f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:243:1: error: from previous declaration ‘float y1f(float) throw ()’ /usr/include/bits/math-finite.h:144:61: error: declaration of ‘long double y1l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:243:1: error: from previous declaration ‘long double y1l(long double) throw ()’ /usr/include/bits/math-finite.h:148:54: error: declaration of ‘double jn(int, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:241:1: error: from previous declaration ‘double jn(int, double) throw ()’ /usr/include/bits/math-finite.h:149:54: error: declaration of ‘float jnf(int, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:241:1: error: from previous declaration ‘float jnf(int, float) throw ()’ /usr/include/bits/math-finite.h:151:66: error: declaration of ‘long double jnl(int, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:241:1: error: from previous declaration ‘long double jnl(int, long double) throw ()’ /usr/include/bits/math-finite.h:155:54: error: declaration of ‘double yn(int, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:244:1: error: from previous declaration ‘double yn(int, double) throw ()’ /usr/include/bits/math-finite.h:156:54: error: declaration of ‘float ynf(int, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:244:1: error: from previous declaration ‘float ynf(int, float) throw ()’ /usr/include/bits/math-finite.h:158:66: error: declaration of ‘long double ynl(int, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:244:1: error: from previous declaration ‘long double ynl(int, long double) throw ()’ /usr/include/bits/math-finite.h:164:68: error: declaration of ‘double lgamma_r(double, int*)’ has a different exception specifier /usr/include/bits/mathcalls.h:273:1: error: from previous declaration ‘double lgamma_r(double, int*) throw ()’ /usr/include/bits/math-finite.h:165:68: error: declaration of ‘float lgammaf_r(float, int*)’ has a different exception specifier /usr/include/bits/mathcalls.h:273:1: error: from previous declaration ‘float lgammaf_r(float, int*) throw ()’ /usr/include/bits/math-finite.h:167:80: error: declaration of ‘long double lgammal_r(long double, int*)’ has a different exception specifier /usr/include/bits/mathcalls.h:273:1: error: from previous declaration ‘long double lgammal_r(long double, int*) throw ()’ /usr/include/bits/math-finite.h: In function ‘double lgamma(double)’: /usr/include/bits/math-finite.h:173:49: error: declaration of ‘double lgamma(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:253:1: error: from previous declaration ‘double lgamma(double) throw ()’ /usr/include/bits/math-finite.h:182:48: error: declaration of ‘float lgammaf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:253:1: error: from previous declaration ‘float lgammaf(float) throw ()’ /usr/include/bits/math-finite.h:192:60: error: declaration of ‘long double lgammal(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:253:1: error: from previous declaration ‘long double lgammal(long double) throw ()’ /usr/include/bits/math-finite.h:206:48: error: declaration of ‘double gamma(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:266:1: error: from previous declaration ‘double gamma(double) throw ()’ /usr/include/bits/math-finite.h:215:47: error: declaration of ‘float gammaf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:266:1: error: from previous declaration ‘float gammaf(float) throw ()’ /usr/include/bits/math-finite.h:225:59: error: declaration of ‘long double gammal(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:266:1: error: from previous declaration ‘long double gammal(long double) throw ()’ /usr/include/bits/math-finite.h: At global scope: /usr/include/bits/math-finite.h:238:51: error: declaration of ‘double log(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:110:1: error: from previous declaration ‘double log(double) throw ()’ /usr/include/bits/math-finite.h:239:51: error: declaration of ‘float logf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:110:1: error: from previous declaration ‘float logf(float) throw ()’ /usr/include/bits/math-finite.h:241:63: error: declaration of ‘long double logl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:110:1: error: from previous declaration ‘long double logl(long double) throw ()’ /usr/include/bits/math-finite.h:245:55: error: declaration of ‘double log10(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:113:1: error: from previous declaration ‘double log10(double) throw ()’ /usr/include/bits/math-finite.h:246:55: error: declaration of ‘float log10f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:113:1: error: from previous declaration ‘float log10f(float) throw ()’ /usr/include/bits/math-finite.h:248:67: error: declaration of ‘long double log10l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:113:1: error: from previous declaration ‘long double log10l(long double) throw ()’ /usr/include/bits/math-finite.h:253:53: error: declaration of ‘double log2(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:146:1: error: from previous declaration ‘double log2(double) throw ()’ /usr/include/bits/math-finite.h:254:53: error: declaration of ‘float log2f(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:146:1: error: from previous declaration ‘float log2f(float) throw ()’ /usr/include/bits/math-finite.h:256:65: error: declaration of ‘long double log2l(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:146:1: error: from previous declaration ‘long double log2l(long double) throw ()’ /usr/include/bits/math-finite.h:261:59: error: declaration of ‘double pow(double, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:155:1: error: from previous declaration ‘double pow(double, double) throw ()’ /usr/include/bits/math-finite.h:262:58: error: declaration of ‘float powf(float, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:155:1: error: from previous declaration ‘float powf(float, float) throw ()’ /usr/include/bits/math-finite.h:264:76: error: declaration of ‘long double powl(long double, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:155:1: error: from previous declaration ‘long double powl(long double, long double) throw ()’ /usr/include/bits/math-finite.h:268:71: error: declaration of ‘double remainder(double, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:290:1: error: from previous declaration ‘double remainder(double, double) throw ()’ /usr/include/bits/math-finite.h:269:70: error: declaration of ‘float remainderf(float, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:290:1: error: from previous declaration ‘float remainderf(float, float) throw ()’ /usr/include/bits/math-finite.h:271:88: error: declaration of ‘long double remainderl(long double, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:290:1: error: from previous declaration ‘long double remainderl(long double, long double) throw ()’ /usr/include/bits/math-finite.h:276:63: error: declaration of ‘double scalb(double, double)’ has a different exception specifier /usr/include/bits/mathcalls.h:365:1: error: from previous declaration ‘double scalb(double, double) throw ()’ /usr/include/bits/math-finite.h:277:62: error: declaration of ‘float scalbf(float, float)’ has a different exception specifier /usr/include/bits/mathcalls.h:365:1: error: from previous declaration ‘float scalbf(float, float) throw ()’ /usr/include/bits/math-finite.h:279:80: error: declaration of ‘long double scalbl(long double, long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:365:1: error: from previous declaration ‘long double scalbl(long double, long double) throw ()’ /usr/include/bits/math-finite.h:284:53: error: declaration of ‘double sinh(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:75:1: error: from previous declaration ‘double sinh(double) throw ()’ /usr/include/bits/math-finite.h:285:53: error: declaration of ‘float sinhf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:75:1: error: from previous declaration ‘float sinhf(float) throw ()’ /usr/include/bits/math-finite.h:287:65: error: declaration of ‘long double sinhl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:75:1: error: from previous declaration ‘long double sinhl(long double) throw ()’ /usr/include/bits/math-finite.h:291:53: error: declaration of ‘double sqrt(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:158:1: error: from previous declaration ‘double sqrt(double) throw ()’ /usr/include/bits/math-finite.h:292:53: error: declaration of ‘float sqrtf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:158:1: error: from previous declaration ‘float sqrtf(float) throw ()’ /usr/include/bits/math-finite.h:294:65: error: declaration of ‘long double sqrtl(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:158:1: error: from previous declaration ‘long double sqrtl(long double) throw ()’ /usr/include/bits/math-finite.h: In function ‘double tgamma(double)’: /usr/include/bits/math-finite.h:300:49: error: declaration of ‘double tgamma(double)’ has a different exception specifier /usr/include/bits/mathcalls.h:260:1: error: from previous declaration ‘double tgamma(double) throw ()’ /usr/include/bits/math-finite.h: In function ‘float tgammaf(float)’: /usr/include/bits/math-finite.h:307:48: error: declaration of ‘float tgammaf(float)’ has a different exception specifier /usr/include/bits/mathcalls.h:260:1: error: from previous declaration ‘float tgammaf(float) throw ()’ /usr/include/bits/math-finite.h: In function ‘long double tgammal(long double)’: /usr/include/bits/math-finite.h:315:60: error: declaration of ‘long double tgammal(long double)’ has a different exception specifier /usr/include/bits/mathcalls.h:260:1: error: from previous declaration ‘long double tgammal(long double) throw ()’