Details
Description
In the debug build of our application, we enable (most) floating point exceptions, as these have helped us catch bugs in third-party components in the past. With the 4.7 tech preview however, QDataStream can now cause floating point exceptions when streaming out doubles, which makes our debug build unusable unless these exceptions are masked.
The problem is that the double is byteswapped using a union with a quint64, then re-assigned to a double. By this stage the double is likely to be in an odd state - in my example it's a denormal number, which raises the exception. Build and run the attached test to illustrate the bug (Windows only).
This change was introduced here: http://qt.gitorious.org/qt/qt/merge_requests/1706. See QDataStream::operator<<(double f). The offending line is the cast back to double with f = x.val1.
I've patched this in our Qt repository - see attached. This is slightly less neat, but safer in environments where floating point exceptions are enabled.