Float constant propagation

Stephen L Moshier moshier@mediaone.net
Tue Aug 31 23:20:00 GMT 1999


>       p = 0.1;
>       ... /* no intervening assignments to p */
>       for (i = 0; i < n; i++)
>               a[i] = 10.0 * p * b[i];
>
>could be turned into:
>
>       for (i = 0; i < n; i++)
>               a[i] = one * b[i];

I did not know this was happening.  It is an unpleasant surprise to
see that change across a statement boundary.  It is just plain
anti-social behavior on the part of the compiler.  I think it should
be rooted out and put under fast-math.



More information about the Gcc mailing list