Skip to content

Commit

Permalink
Update the AVX+Whole Program Opt bug workaround to only be applied on…
Browse files Browse the repository at this point in the history
… compilers that are older than VS2013 Update 4 (it was fixed in VS2013 Update 2 according to Microsoft).
  • Loading branch information
juj committed Sep 7, 2015
1 parent 0bd9303 commit 45e9266
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 2.8)
cmake_policy(SET CMP0054 NEW) # Don't expand vars inside quotes, i.e. don't expand a line of form: ''if ("MSVC")'', but require ''if ("${MSVC}")''

project(MathGeoLib)

include(CommonOptions.cmake)
Expand Down
10 changes: 6 additions & 4 deletions CommonOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,12 @@ if (MSVC)
set(relLinkFlags "${relLinkFlags} /OPT:REF")
endif()

# XXX Work around MSVC bug with x64 + /GL + /O2 /arch:AVX, see https://connect.microsoft.com/VisualStudio/feedback/details/814682/visual-studio-2013-x64-compiler-generates-faulty-code-with-gl-o2-arch-avx-flags-enabled
if (MATH_AVX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VS_BUG TRUE)
message(STATUS "NOTE: Whole Program Optimization is disabled due to detected MSVC bug with x64+/O2+/GL+/arch:AVX!")
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 18.0.31101.0)
# XXX Work around MSVC bug with x64 + /GL + /O2 /arch:AVX, see https://connect.microsoft.com/VisualStudio/feedback/details/814682/visual-studio-2013-x64-compiler-generates-faulty-code-with-gl-o2-arch-avx-flags-enabled
if (MATH_AVX AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set(VS_BUG TRUE)
message(STATUS "NOTE: Whole Program Optimization is disabled due to detected MSVC bug with x64+/O2+/GL+/arch:AVX! Install VS2013 Update 4 or newer to avoid this issue.") # First fix was actually in VS2013 Update 2 already, but don't know what the version of that compiler was.
endif()
endif()
if (NOT VS_BUG)
# Whole Program Optimization: Yes (/GL)
Expand Down

0 comments on commit 45e9266

Please sign in to comment.