diff --git a/test/packetmath.cpp b/test/packetmath.cpp
index b6616ac5e..f1826f0ef 100644
--- a/test/packetmath.cpp
+++ b/test/packetmath.cpp
@@ -18,7 +18,9 @@ template<typename T> T negate(const T& x) { return -x; }
 }
 }
 
-template<typename Scalar> bool isApproxAbs(const Scalar& a, const Scalar& b, const typename NumTraits<Scalar>::Real& refvalue)
+// NOTE: we disbale inlining for this function to workaround a GCC issue when using -O3 and the i387 FPU.
+template<typename Scalar> EIGEN_DONT_INLINE
+bool isApproxAbs(const Scalar& a, const Scalar& b, const typename NumTraits<Scalar>::Real& refvalue)
 {
   return internal::isMuchSmallerThan(a-b, refvalue);
 }