This testcase shows the problem when compiled with -ffast-math: double test1(double x) { double y1, y2;
y1 = sin(x); y2 = cos(x); return y1 / y2; } double test2(double x) { return sin(x) / cos(x); } gcc -O2 -ffast-math: _.099t.optimized: ;; Function test2 (test2) Analyzing Edge Insertions. test2 (x) { <bb 2>: return __builtin_tan (x) [tail call]; } ;; Function test1 (test1) Analyzing Edge Insertions. test1 (x) { <bb 2>: return sin (x) / cos (x); } -- Summary: sin (x) / cos (x) is not always folded to tan (x) Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ubizjak at gmail dot com GCC build triplet: i686-pc-linux-gnu GCC host triplet: i686-pc-linux-gnu GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29985