The example code below, compiled on x86 with gcc versions 4.1.2 through 4.4.0, aborts when executed.
int main(void)__attribute__ ((optimize("O1"))); // Also with '-O2'
const float a = rand(); // Any function call that returns 1804289383 will do
volatile float tmp=a;
assert(tmp==a); // This one aborts
assert(tmp==a); // This one passes (if line above is replaced with printf)
If you replace assert() with two consecutive printf("%f ", a), two different values are displayed for the constant variable a.
I think this is a dup of bug 323.
And it is as it works correctly with -std=c99 in 4.5.0 and above and it works correctly on x86_64 or with -mfpmath=sse.
*** This bug has been marked as a duplicate of 323 ***