From 128c8abf443b62b9ea60983969164c6635ec891d Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Fri, 2 Feb 2024 15:27:21 -0800 Subject: [PATCH] Fix gcc-6 bug in the rand test. --- test/rand.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/rand.cpp b/test/rand.cpp index bb90ad9c3..b5cf801f3 100644 --- a/test/rand.cpp +++ b/test/rand.cpp @@ -10,8 +10,11 @@ #include #include "main.h" +// For GCC-6, if this function is inlined then there seems to be an optimization +// bug that triggers a failure. This failure goes away if you access `r` in +// in any way, and for any other compiler. template -Scalar check_in_range(Scalar x, Scalar y) { +EIGEN_DONT_INLINE Scalar check_in_range(Scalar x, Scalar y) { Scalar r = internal::random(x, y); VERIFY(r >= x); if (y >= x) {