http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56125
Bug #: 56125 Summary: -O2 -ffast-math generates bad code when dividing a double by the square of another double. Classification: Unclassified Product: gcc Version: 4.7.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassig...@gcc.gnu.org ReportedBy: medna...@gmail.com Created attachment 29288 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29288 Test program. XXX@willow:~$ gcc -O0 -o weird weird.c XXX@willow:~$ ./weird 7.250000 XXX@willow:~$ gcc -O2 -o weird weird.c XXX@willow:~$ ./weird 7.250000 XXX@willow:~$ gcc -ffast-math -O2 -o weird weird.c XXX@willow:~$ ./weird 5.126524 Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-5)