Description: Disable -fno-math-errno on arm64 to workaroun gcc 14 bug (#1094828)
Author: Shengqi Chen <harry@debian.org>
Bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118892
Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1094828
Last-Update: 2025-02-18 
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: pytorch/CMakeLists.txt
===================================================================
--- pytorch.orig/CMakeLists.txt
+++ pytorch/CMakeLists.txt
@@ -1092,7 +1092,9 @@ if(NOT MSVC)
     string(APPEND CMAKE_CXX_FLAGS_DEBUG " -fno-omit-frame-pointer -O0")
     string(APPEND CMAKE_LINKER_FLAGS_DEBUG " -fno-omit-frame-pointer -O0")
   endif()
+  if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64" OR NOT CMAKE_CXX_COMPILER_ID MATCHES "GNU")
   append_cxx_flag_if_supported("-fno-math-errno" CMAKE_CXX_FLAGS)
+  endif()
   append_cxx_flag_if_supported("-fno-trapping-math" CMAKE_CXX_FLAGS)
   append_cxx_flag_if_supported("-Werror=format" CMAKE_CXX_FLAGS)
   if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 13)
