From fe614c6069e8569048778ce79bad82a5ffd0e282 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 3 Mar 2021 22:56:07 +0100 Subject: [PATCH] Enable less FP exceptions for clang compiler when running tesseract Signed-off-by: Stefan Weil --- src/api/tesseractmain.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/api/tesseractmain.cpp b/src/api/tesseractmain.cpp index 543d59938..edf6637e1 100644 --- a/src/api/tesseractmain.cpp +++ b/src/api/tesseractmain.cpp @@ -622,7 +622,12 @@ static void PreloadRenderers( int main(int argc, char** argv) { #if defined(__USE_GNU) // Raise SIGFPE. +#if defined(__clang__) + // clang creates code which causes some FP exceptions, so don't enable those. + feenableexcept(FE_DIVBYZERO); +#else feenableexcept(FE_DIVBYZERO | FE_OVERFLOW | FE_INVALID); +#endif #endif const char* lang = nullptr; const char* image = nullptr;