--- Robert Dewar wrote: > And so? Why would you expect this particular example > to give an assertion error. I would not expect an > assert error here. In unoptimized mode, you > certainly > do not expect it, and in optimized mode, I would > expect the register tracker to know that a and x are > in the same register at the point of assertion (and > perhaps even eliminate the comparison entirely). >
The previous posted case only adds few new lines of insignificant line of code from: test-case.c: #include <assert,h> volatile float x = 3; int main() { float a = 1 / x; x = a; assert(a == x); } to test.c: #include <assert.h> #include <stdio.h> volatile float x = 3; int main() { float a = 1 / x; x = a; assert(a == x); printf("a has value of %g \n",a); printf("x has value of %g \n",x); assert((int)a == 0); assert((int)x == 0); return 0; } I would expect the seem behaviour for both cases. test-case.c cause an assertion failure with {-O1,-O2,-O3} but test.c does not all. The first few lines of both case are pretty simalar. ___________________________________________________________ Yahoo! Messenger - NEW crystal clear PC to PC calling worldwide with voicemail http://uk.messenger.yahoo.com