Commit 0bb9ba40 authored by Carsten Gräser's avatar Carsten Gräser

Disable floating point exceptions for clang

When compiling with `-O3` clang versions >= 5.0 may
generate code containing auxiliary operations dividing
by zero altough the result is not used. Specifically code like this

```cpp
for (int i=0; i<=3; i++)
  for (int j=0; j<=3; j++)
    for (int k=0; k<=3; k++)
      if ((m!=i) && (m!=j) && (m!=k))
        z += x*(1.0/(m-k))*(1.0/(m-j))*(1.0/(m-i));
```

should never devide by zero. While the result of the code
is correct with clang, it seems to produce additional
operations for the ruled out cases where we would devide by zero.
For more details see the clang bug: https://bugs.llvm.org/show_bug.cgi?id=40280

The only possible solution on our side is to turn of FP exceptions
for clang.
parent 9db402df
Pipeline #15770 passed with stage
in 13 minutes and 52 seconds
......@@ -102,7 +102,7 @@ int main (int argc, char *argv[])
{
#if __linux__ \
&& (!defined __INTEL_COMPILER || __INTEL_COMPILER >= 1010) \
&& (!defined __clang__ || __clang_major__ >= 4)
&& (!defined __clang__)
feenableexcept(FE_INVALID | FE_DIVBYZERO | FE_OVERFLOW);
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment