Skip to content
Snippets Groups Projects

Disable FPE trapping when using unsafe maths.

Merged Peter W. Draper requested to merge no-unsafe-fpe into master
1 file
+ 19
9
Compare changes
  • Side-by-side
  • Inline
+ 19
9
@@ -1587,16 +1587,26 @@ else
have_chealpix="no"
fi
# Check for floating-point exception support.
# CLANG based compilers can generate SIMD divides with partially loaded
# registers so we see a 0/0 NaN which results in an FPE which is not an
# error. So we do not allow this with those compilers. If you want to do
# that then beware and use the -ffp-exception-behavior=maytrap flag.
if test "$ax_cv_c_compiler_vendor" != "oneapi" -a \
"$ax_cv_c_compiler_vendor" != "clang"; then
AC_CHECK_FUNC(feenableexcept, AC_DEFINE([HAVE_FE_ENABLE_EXCEPT],[1],
[Defined if the floating-point exception can be enabled using non-standard GNU functions.]))
# Check for floating-point exception trapping support.
#
# We do not allow this to be enabled when optimizing as compilers do operations
# which are unsafe for speed. This can result in FPEs on valid vector
# operations when additional padding is used. This has been seen on clang and
# GCC based compilers.
if test "$enable_opt" != "yes"; then
if test "$ax_cv_c_compiler_vendor" != "oneapi"; then
AC_CHECK_FUNC(feenableexcept, AC_DEFINE([HAVE_FE_ENABLE_EXCEPT],[1],
[Defined if floating-point exceptions can be trapped.]))
else
# Default optimization for Intel is too high , -O2, so we also need
# to have debugging enabled which uses -O0 as well.
if test "$ax_enable_debug" != "no"; then
AC_CHECK_FUNC(feenableexcept, AC_DEFINE([HAVE_FE_ENABLE_EXCEPT],[1],
[Defined if floating-point exceptions can be trapped.]))
fi
fi
fi
# Check for setaffinity.
AC_CHECK_FUNC(pthread_setaffinity_np, AC_DEFINE([HAVE_SETAFFINITY],[1],
[Defined if pthread_setaffinity_np exists.]) )
Loading