Avoid using std::raise() for divide by zero
diff --git a/Eigen/Core b/Eigen/Core index 48c2121..623d735 100644 --- a/Eigen/Core +++ b/Eigen/Core
@@ -177,10 +177,6 @@ #include "src/Core/arch/Default/TypeCasting.h" #include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h" -#ifndef EIGEN_GPU_COMPILE_PHASE - #include <csignal> -#endif - #if defined EIGEN_VECTORIZE_AVX512 #if defined EIGEN_VECTORIZE_AVX512FP16 #include "src/Core/arch/AVX512/PacketMathFP16.h"
diff --git a/Eigen/src/Core/functors/BinaryFunctors.h b/Eigen/src/Core/functors/BinaryFunctors.h index eaa4352..c8bb4e7 100644 --- a/Eigen/src/Core/functors/BinaryFunctors.h +++ b/Eigen/src/Core/functors/BinaryFunctors.h
@@ -388,7 +388,11 @@ struct maybe_raise_div_by_zero<Packet, true> { static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Packet x) { if (EIGEN_PREDICT_FALSE(predux_any(pcmp_eq(x, pzero(x))))) { - std::raise(SIGFPE); + // Use volatile variables to force a division by zero, which will + // result in the default platform behaviour (usually SIGFPE). + volatile typename unpacket_traits<Packet>::type zero = 0; + volatile typename unpacket_traits<Packet>::type val = 1; + val = val / zero; } } };