From 57717a20d39be4f6d3d5fe477660b8fce84b2eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Guilloux?= Date: Tue, 13 Sep 2022 12:27:49 +0200 Subject: [PATCH] Fix #9966: workaround a VS2022 optimisation bug (#10029) --- cmake/CompileFlags.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/CompileFlags.cmake b/cmake/CompileFlags.cmake index ad4a46aca7..b1cec89daf 100644 --- a/cmake/CompileFlags.cmake +++ b/cmake/CompileFlags.cmake @@ -56,6 +56,11 @@ macro(compile_flags) if(MSVC) add_compile_options(/W3) + if(MSVC_VERSION GREATER 1929) + # Starting with version 19.30, there is an optimisation bug, see #9966 for details + # This flag disables the broken optimisation to work around the bug + add_compile_options(/d2ssa-rse-) + endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") add_compile_options( -W