diff --git a/Eigen/Core b/Eigen/Core index 48c212189..623d735d6 100644 --- a/Eigen/Core +++ b/Eigen/Core @@ -177,10 +177,6 @@ using std::ptrdiff_t; #include "src/Core/arch/Default/TypeCasting.h" #include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h" -#ifndef EIGEN_GPU_COMPILE_PHASE - #include -#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 eaa4352b8..c8bb4e775 100644 --- a/Eigen/src/Core/functors/BinaryFunctors.h +++ b/Eigen/src/Core/functors/BinaryFunctors.h @@ -388,7 +388,11 @@ template struct maybe_raise_div_by_zero { 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::type zero = 0; + volatile typename unpacket_traits::type val = 1; + val = val / zero; } } };