From 818bcd74cae6cc97023971b2422a81220d3b0fa0 Mon Sep 17 00:00:00 2001 From: Lars Bilke <lars.bilke@ufz.de> Date: Wed, 6 Sep 2017 21:12:41 +0200 Subject: [PATCH] [cli] Enable fp exceptions for macOS. Related: - #1887 - https://stackoverflow.com/a/340683/80480 This slipped through as currently macOS is not tested via CI. --- Applications/CLI/ogs.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Applications/CLI/ogs.cpp b/Applications/CLI/ogs.cpp index ad40c3315dd..af931ac1850 100644 --- a/Applications/CLI/ogs.cpp +++ b/Applications/CLI/ogs.cpp @@ -14,7 +14,11 @@ #include <tclap/CmdLine.h> #ifndef _WIN32 +#ifdef __APPLE__ +#include <xmmintrin.h> +#else #include <cfenv> +#endif // __APPLE__ #endif // _WIN32 #ifdef USE_PETSC @@ -111,7 +115,11 @@ int main(int argc, char *argv[]) #ifndef _WIN32 // On windows this command line option is not present. // Enable floating point exceptions if (enable_fpe_arg.isSet()) +#ifdef __APPLE__ + _MM_SET_EXCEPTION_MASK(_MM_GET_EXCEPTION_MASK() & ~_MM_MASK_INVALID); +#else feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW); +#endif // __APPLE__ #endif // _WIN32 BaseLib::RunTime run_time; -- GitLab