Reset FPU precision back to MSVCRT defaults
authorTamar Christina <tamar@zhox.com>
Wed, 14 Dec 2016 21:45:35 +0000 (16:45 -0500)
committerBen Gamari <ben@smart-cactus.org>
Thu, 15 Dec 2016 15:42:25 +0000 (10:42 -0500)
commit6f7d8279cea4aa1082fb07adf5da507297e21ee8
treeae127f06d0fc89a5d6eaafbe0a5bb9af263d4690
parent0c3341b23e0672fb9c05d9f6ab0be76f411d526e
Reset FPU precision back to MSVCRT defaults

Mingw-w64 does a stupid thing. They set the FPU precision to extended
mode by default.  The reasoning is that it's for compatibility with GNU
Linux ported libraries. However the problem is this is incompatible with
the standard Windows double precision mode.  In fact, if we create a new
OS thread then Windows will reset the FPU to double precision mode.  So
we end up with a weird state where the main thread by default has a
different precision than any child threads.

Test Plan: ./validate new test T7289

Reviewers: simonmar, austin, bgamari, erikd

Reviewed By: simonmar

Subscribers: thomie, #ghc_windows_task_force

Differential Revision: https://phabricator.haskell.org/D2819

GHC Trac Issues: #7289
rts/RtsStartup.c
testsuite/tests/rts/T7289/Makefile [new file with mode: 0644]
testsuite/tests/rts/T7289/T7289.hs [new file with mode: 0644]
testsuite/tests/rts/T7289/T7289.stdout [new file with mode: 0644]
testsuite/tests/rts/T7289/all.T [new file with mode: 0644]
testsuite/tests/rts/T7289/fp.c [new file with mode: 0644]