From 3cd5a7d19a9222cca1ef4d6fda3da0d55c8c8be5 Mon Sep 17 00:00:00 2001 From: HanifKoh <76276251+HanifKoh@users.noreply.github.com> Date: Mon, 16 Nov 2026 15:35:35 +0800 Subject: [PATCH] Work Around the MSVC 14.52 ARM64 Internal Compiler Error in OCCT (#17601) The windows-11-vs2026-arm runner image 20261112.217.1 moved from MSVC 14.51 to 14.52, and its cl.exe crashes with C1001 while optimizing OCCT's BRepGraph_LayerTopoSupplement.cxx. clang-cl builds compile OCCT with cl on ARM64, so every Windows arm64 deps build on that image fails. A second OCCT patch compiles that one file without optimization when the compiler is cl targeting ARM64. Other compilers and architectures see no change. (cherry picked from commit e0f7f0b7eeac019668d637e1733bbf9f665a6b39) --- ...-BRepGraph-MSVC-ARM64-ICE-workaround.patch | 25 +++++++++++++++++++ deps/OCCT/OCCT.cmake | 6 ++++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 deps/OCCT/0002-BRepGraph-MSVC-ARM64-ICE-workaround.patch diff --git a/deps/OCCT/0002-BRepGraph-MSVC-ARM64-ICE-workaround.patch b/deps/OCCT/0002-BRepGraph-MSVC-ARM64-ICE-workaround.patch new file mode 100644 index 0000000000..9b007cd57b --- /dev/null +++ b/deps/OCCT/0002-BRepGraph-MSVC-ARM64-ICE-workaround.patch @@ -0,0 +1,25 @@ +diff --git a/src/ModelingData/TKBRep/BRepGraph/BRepGraph_LayerTopoSupplement.cxx b/src/ModelingData/TKBRep/BRepGraph/BRepGraph_LayerTopoSupplement.cxx +index 44e59b0..8833fed 100644 +--- a/src/ModelingData/TKBRep/BRepGraph/BRepGraph_LayerTopoSupplement.cxx ++++ b/src/ModelingData/TKBRep/BRepGraph/BRepGraph_LayerTopoSupplement.cxx +@@ -21,6 +21,12 @@ + #include + #include + ++// MSVC 14.52 for ARM64 crashes with an internal compiler error (C1001) while ++// optimizing this file, so it is compiled without optimization there. ++#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64) ++ #pragma optimize("", off) ++#endif ++ + IMPLEMENT_STANDARD_RTTIEXT(BRepGraph_LayerTopoSupplement, BRepGraph_Layer) + + namespace +@@ -384,3 +390,7 @@ void BRepGraph_LayerTopoSupplement::removeOwner(const BRepGraph_NodeId theOwner) + myOwnerToUids.UnBind(theOwner); + touch(); + } ++ ++#if defined(_MSC_VER) && !defined(__clang__) && defined(_M_ARM64) ++ #pragma optimize("", on) ++#endif diff --git a/deps/OCCT/OCCT.cmake b/deps/OCCT/OCCT.cmake index 1f63615034..a31b587b32 100644 --- a/deps/OCCT/OCCT.cmake +++ b/deps/OCCT/OCCT.cmake @@ -34,7 +34,11 @@ orcaslicer_add_cmake_project(OCCT URL_HASH SHA256=7c033d917ee8f040c0512d289dcc5f02c148889d5bac17c3e25639accb44f0da # Makes BRepMesh triangulate cone faces whose seam pcurve is slightly tilted # (Open-Cascade-SAS/OCCT#572); remove the patch once an OCCT release includes the fix. - PATCH_COMMAND git apply ${OCCT_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-BRepMesh-seam-pcurve-at-edge-parameter.patch + # 0002 compiles one file without optimization under cl for ARM64, where MSVC 14.52 crashes + # on it with an internal compiler error; remove it once the runner image ships a fixed MSVC. + PATCH_COMMAND git apply ${OCCT_DIRECTORY_FLAG} --verbose --ignore-space-change --whitespace=fix + ${CMAKE_CURRENT_LIST_DIR}/0001-BRepMesh-seam-pcurve-at-edge-parameter.patch + ${CMAKE_CURRENT_LIST_DIR}/0002-BRepGraph-MSVC-ARM64-ICE-workaround.patch #DEPENDS dep_Boost CMAKE_ARGS -DCMAKE_CXX_STANDARD=17