------- Comment #2 from benoit dot hudson at gmail dot com 2009-07-30 23:58 ------- > Note that -frounding-math should disable the proposed optimization.
Ah, true; and that means that with the options I said to use, the optimization is simply wrong. However, I see the same behaviour even with -ffast-math and -funsafe-math-optimization and various other such options. Also, squaring z is not necessary. The following program has the same behaviour: double A (double x, double y, double z) { return x - y * z; } double B (double x, double y, double z) { return x + (-y * z); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40921