[Vm-dev] FloatMathPlugin crashes the VM if compiled with gcc
andreas.raab at gmx.de
Sun Dec 26 20:57:21 UTC 2010
On 12/26/2010 8:40 PM, Igor Stasenko wrote:
> Note, that on unix and mac it defines -DNO_ISNAN
> while on win32, it compiles with -O0 flag, which turns off all optimizations.
> It would be good to know why optimization(s) causing crash, and how we
> could fix that in code,
> because i'm not in favor having VM which stability depends on
> compiler peculiarities.
Because fdlibm aliases integer pointers with floating point values.
Compilers generally don't assume that, i.e.,
double foo = 1.0;
unsigned int *highWord = (unsigned int*)&foo;
unsigned int *highWord = ((unsigned int*)&foo)++;
*highWord |= 0x8000000;
might change the sign of foo and that it would invalidate a prior value
in an fpu register. But fdlibm does this kind of stuff *all the time*.
More information about the Vm-dev