Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds
authorMagnus Hagander
Thu, 10 Mar 2016 12:48:58 +0000 (13:48 +0100)
committerMagnus Hagander
Thu, 10 Mar 2016 13:10:41 +0000 (14:10 +0100)
commit8857488b64c34c8084a14ebefbd667fd5285d1a8
tree82cf4a0e0cfc1851c6154fcd7884b50f0d274999
parent4f37d091694d77b15f36a8a220025f5faa1ed296
Avoid crash on old Windows with AVX2-capable CPU for VS2013 builds

The Visual Studio 2013 CRT generates invalid code when it makes a 64-bit
build that is later used on a CPU that supports AVX2 instructions using a
version of Windows before 7SP1/2008R2SP1.

Detect this combination, and in those cases turn off the generation of
FMA3, per recommendation from the Visual Studio team.

The bug is actually in the CRT shipping with Visual Studio 2013, but
Microsoft have stated they're only fixing it in newer major versions.
The fix is therefor conditioned specifically on being built with this
version of Visual Studio, and not previous or later versions.

Author: Christian Ullrich
src/backend/main/main.c