------- Comment #2 from piotr dot wyderski at gmail dot com 2010-03-31 11:00 ------- With -ffast-math the code becomes
.file "testcase.cpp" .text .p2align 4,,15 .globl __Z3fn1d .def __Z3fn1d; .scl 2; .type 32; .endef __Z3fn1d: fldl 4(%esp) fsincos fmulp %st, %st(1) ret .p2align 4,,15 .globl __Z3fn2d .def __Z3fn2d; .scl 2; .type 32; .endef __Z3fn2d: fldl 4(%esp) fsincos fmulp %st, %st(1) ret which is exactly the expected output, but: -ffast-math: This option should never be turned on by any -O option since it can result in incorrect output for programs which depend on an exact implementation of IEEE or ISO rules/specifications for math functions. So, what IEEE rules does the fsin/fcos/fsincos emission/fussion break? The only problem I see is excessive accuracy, but it can be removed using the fld/fst trick used by -ffloat-store (and THAT can be removed by -ffast-math), without the need to declare the entire program as IEEE754 non-conformant. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43599