Skip to content

Commit 574c1a2

Browse files
authored
Add WA for MSVC compiler mutex constructor issue with VS2022 (openvinotoolkit#28169)
### Details: - This issue is a MSVC compiler bug affecting certain versions of Visual Studio 2022. When using std::mutex a null dereference may occur, leading to a silent crash in Release mode. - Adding the compiler option "/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" serves as a workaround for this problem. Reference: https://hydrogenaud.io/index.php/topic,126070.0.html https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710 ### Tickets: - CVS-159684
1 parent 8d74cbb commit 574c1a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmake/developer_package/compile_flags/os_flags.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
455455
# Build with multiple processes
456456
ov_add_compiler_flags(/MP)
457457

458+
# Workaround for an MSVC compiler issue in some versions of Visual Studio 2022.
459+
# The issue involves a null dereference to a mutex. For details, refer to link https://github.com/microsoft/STL/wiki/Changelog#vs-2022-1710
460+
if(MSVC AND MSVC_VERSION GREATER_EQUAL 1930 AND MSVC_VERSION LESS 1941)
461+
ov_add_compiler_flags(/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
462+
endif()
463+
458464
if(AARCH64 AND NOT MSVC_VERSION LESS 1930)
459465
# otherwise, _ARM64_EXTENDED_INTRINSICS is defined, which defines 'mvn' macro
460466
ov_add_compiler_flags(/D_ARM64_DISTINCT_NEON_TYPES)

0 commit comments

Comments
 (0)