diff --git a/src/backend/main/main.c b/src/backend/main/main.c index 19176b1..4be21a0 100644 --- a/src/backend/main/main.c +++ b/src/backend/main/main.c @@ -26,6 +26,13 @@ #include #endif +#ifdef _WIN32 +#if _MSC_VER == 1800 +#include +#include +#endif +#endif + #include "bootstrap/bootstrap.h" #include "common/username.h" #include "postmaster/postmaster.h" @@ -263,6 +270,22 @@ startup_hacks(const char *progname) /* In case of general protection fault, don't show GUI popup box */ SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX); + +#ifdef _M_AMD64 +#if _MSC_VER == 1800 + /* + * Avoid crashing in certain floating-point operations if + * we were compiled for x64 with MS Visual Studio 2013 and + * are running on Windows prior to 7/2008R2 SP1 on an + * AVX2-capable CPU. + */ + if (!IsWindows7SP1OrGreater()) + { + _set_FMA3_enable(0); + } +#endif /* _MSC_VER == 1800 */ +#endif /* _M_AMD64 */ + } #endif /* WIN32 */