From 871e2e5339476ae3f7efe63a0156507fd10c73d7 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Sun, 3 Feb 2019 08:54:47 +0100 Subject: [PATCH] bug #1674: disable GCC's unsafe-math-optimizations in sin/cos vectorization (results are completely wrong otherwise) --- Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h index ce3f0fc68..693dd55ea 100644 --- a/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h +++ b/Eigen/src/Core/arch/Default/GenericPacketMathFunctions.h @@ -319,6 +319,9 @@ inline float trig_reduce_huge (float xf, int *quadrant) template EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_UNUSED +#if EIGEN_GNUC_AT_LEAST(4,4) +__attribute__((optimize("-fno-unsafe-math-optimizations"))) +#endif Packet psincos_float(const Packet& _x) { typedef typename unpacket_traits::integer_packet PacketI;