From e8f45fad4071512a116dd983ae85e47f2d776f6f Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Fri, 18 Jan 2019 12:07:13 +0200 Subject: [PATCH] - workaround MSVC 2015 code generation issue, x64 only With optimization turned on illegal instructions were generated for turbo CVAR handler function https://forum.zdoom.org/viewtopic.php?t=63157 --- src/g_game.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/g_game.cpp b/src/g_game.cpp index da1430d84..2d463455f 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -222,6 +222,12 @@ EXTERN_CVAR (Int, team) CVAR (Bool, teamplay, false, CVAR_SERVERINFO) +// Workaround for x64 code generation bug in MSVC 2015 +// Optimized targets contain illegal instructions in the function below +#if defined _M_X64 && _MSC_VER < 1910 +#pragma optimize("", off) +#endif // _M_X64 && _MSC_VER < 1910 + // [RH] Allow turbo setting anytime during game CUSTOM_CVAR (Float, turbo, 100.f, CVAR_NOINITCALL) { @@ -244,6 +250,10 @@ CUSTOM_CVAR (Float, turbo, 100.f, CVAR_NOINITCALL) } } +#if defined _M_X64 && _MSC_VER < 1910 +#pragma optimize("", on) +#endif // _M_X64 && _MSC_VER < 1910 + CCMD (turnspeeds) { if (argv.argc() == 1)