http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50032
Summary: Bad optimization with sin/cos
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: [email protected]
ReportedBy: [email protected]
Created attachment 24966
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24966
Sample code of the bug
When I compile and run the attached code, the optimizations make the code run
slower.
If I change the variable ang to double, the optimizations work (making the code
run faster than without optimization).
Checking the assembly output, I find that the compiler is changing the function
being called from cos and sin to sincosf instead of calling sincos to save a
cast. But it seems sincos is faster than sincosf (fpu is optimized for double).
System: Ubuntu 11.04, 64 bits, Intel(R) Core(TM)2 Duo CPU P8700 @ 2.53GHz
Gcc: 4.5.2