[Bug 30465] BridgeCentral: Invalid floating point operation in mozjs.dll (fldcw in JSDOUBLE_IS_INT32)

wine-bugs at winehq.org wine-bugs at winehq.org
Tue Apr 17 06:43:25 CDT 2012


http://bugs.winehq.org/show_bug.cgi?id=30465

--- Comment #4 from Ulrik Dickow <u.dickow at gmail.com> 2012-04-17 06:43:25 CDT ---
Created attachment 39836
  --> http://bugs.winehq.org/attachment.cgi?id=39836
Small stand-alone C(++) test program fiddling with the floating point CW

This small C/C++ test program demonstrates the effect of the floating point
control word on the x86 platform using old-fashioned 387 code (the default on
32-bit compiles).  It shows that if the CW, as in the wine crash, is 0x1372
when we reach the cast

    (int32_t) d

then that cast will indeed trigger an Invalid floating point operation
exception IF d is too large to fit in an int32_t -- but not if it just has a
value at or between two valid 32 bit integers.

So a simple and portable way of avoiding the problem, modifying only Gecko C++
source code, would be to replace

    if (JSDOUBLE_IS_NEGZERO(d))
with
    if (JSDOUBLE_IS_NEGZERO(d) || d < INT32_MIN || d > INT32_MAX)

in JSDOUBLE_IS_INT32 in wine-gecko/js/src/jsval.h.

Oops, now I see that only a few days ago in the main git repo for wine-gecko,
it was replaced with MOZ_DOUBLE_IS_INT32 -- but the same implementation, so the
same fix can apply.  It will make the code slower, though.

The test program also proves that if you compile with -mfpmath=sse -msse2, it
will not crash.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list