Hi,
The optimizer folds “(unsigned int) -1.0f” to 0. As a result, the following routine foo returns 0 with optimization, and returns -1 (0xffffffff) without optimization.
unsigned int foo()
{
float myfloat = -1.0f;
unsigned int myint = (unsigned int) myfloat;
return myint;
}
INSTCOMBINE ITERATION #0 on
IC: ConstFold to: i32 0 from: %conv = fptoui float -1.000000e+000 to i32 ; [#uses=1]
While the result of “(unsigned int) -1.0f” is probably implementation defined, both gcc and Microsoft cl produce -1.
Will you consider this an optimizer bug and fix it?
Thanks,
bixia