--- Daniel Berlin wrote: > > Let's take a duplicate of 323, 21809 > > > Compiling the code there with icc gives us: > > [EMAIL PROTECTED]:~> icc icca.c > icca.c(7): warning #1572: floating-point equality > and inequality > comparisons are unreliable > assert(a == x); > ^ > > ./[EMAIL PROTECTED]:~> ./a.out > a.out: icca.c:7: main: Assertion `a == x' failed. > Aborted > > In order to get icc to not generate an executable > that will abort, you > have to pass special flags (the same way we have > -ffloat-store, except I > believe their -mp flag will just disable any > optimization that could get > in the way of this working). > > One of these flag options is to tell it to use > processor specific > instructions, which auto turns on the equivalent of > -mfpmath=sse. >
Here is another case for you try out: 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; } Compile this gcc {-O0,-O1,-O2,-O3,-Os} You will notice it will always works (despite not using -ffloat-store) and not cause an assertion failure at all. ___________________________________________________________ How much free photo storage do you get? Store your holiday snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com