From b68d25f64a84a200b75a895af9c5887ce4a149bc Mon Sep 17 00:00:00 2001 From: Erik Lindahl Date: Wed, 6 Nov 2019 14:00:37 +0100 Subject: [PATCH] Work around broken Apple compilers in Mac OS 10.15 The Xcode compiler in Mac OS Catalina checks and enforces stack alignment by default, but embarrasingly enough the C library provided by Apple fails to adhere to the aligned stack for AVX despite bug reports being filed during their beta cycle. We work around this sloppiness by removing the check, since AVX does not require the alignment. Fixes #3199. Change-Id: I9c16b156cc5b3a5d9fc542335cbf63a6caf6fb1b --- cmake/gmxCFlags.cmake | 19 +++++++++++++++++++ docs/release-notes/2019/2019.5.rst | 11 ++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/cmake/gmxCFlags.cmake b/cmake/gmxCFlags.cmake index b0dee1dcd1..75e2176868 100644 --- a/cmake/gmxCFlags.cmake +++ b/cmake/gmxCFlags.cmake @@ -415,6 +415,25 @@ GMX_TEST_CFLAG(CFLAGS_WARN "/W3;/wd161;/wd177;/wd411;/wd593;/wd981;/wd1418;/wd14 endif() endif() + # Apple bastardized version of Clang + if(${CMAKE_C_COMPILER_ID} MATCHES "AppleClang") + if(${CMAKE_C_COMPILER_VERSION} VERSION_GREATER 11.0) + # Mac OS Catalina ships with a horribly broken compiler (version 11.0.0.11000033) + # that checks stack alignment by default, but their own C library + # does not align the stack properly. Embarrassing, Apple... + GMX_TEST_CFLAG(CFLAG_NO_STACK_CHECK "-fno-stack-check" GMXC_CFLAGS) + endif() + endif() + + if(${CMAKE_CXX_COMPILER_ID} MATCHES "AppleClang") + if(${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 11.0) + # Mac OS Catalina ships with a horribly broken compiler (version 11.0.0.11000033) + # that checks stack alignment by default, but their own C library + # does not align the stack properly. Embarrassing, Apple... + GMX_TEST_CXXFLAG(CXXFLAG_NO_STACK_CHECK "-fno-stack-check" GMXC_CXXFLAGS) + endif() + endif() + # Fujitsu compilers on PrimeHPC/Sparc64 if(${CMAKE_C_COMPILER_ID} MATCHES Fujitsu OR (${CMAKE_C_COMPILER_ID} MATCHES unknown AND ${CMAKE_C_COMPILER} MATCHES ^fcc)) diff --git a/docs/release-notes/2019/2019.5.rst b/docs/release-notes/2019/2019.5.rst index a34b88e85b..1017afb17f 100644 --- a/docs/release-notes/2019/2019.5.rst +++ b/docs/release-notes/2019/2019.5.rst @@ -42,7 +42,16 @@ We don't expect this to have caused incorrect results, but a memory checker would complain. :issue:`3173` - + +Work around broken Apple Clang compiler in Mac OS Catalina +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +In Mac OS Catalina, the default XCode compilers checks and +enforces stack alignment. This would have been a good idea +if Apple itself did not ship a C library that violates the +stack alignment with AVX instructions are enabled. + +:issue:`3199` + Fixes for ``gmx`` tools ^^^^^^^^^^^^^^^^^^^^^^^ -- 2.11.4.GIT