From 8ec68856a6985ed2da896d06e2a917c77862bdfa Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen <4643818-rmlarsen1@users.noreply.gitlab.com> Date: Thu, 2 Apr 2026 14:14:54 -0700 Subject: [PATCH] Fix basicstuff_8 casting test failure on loongarch64 libeigen/eigen!2379 Co-authored-by: Rasmus Munk Larsen --- test/basicstuff.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/basicstuff.cpp b/test/basicstuff.cpp index 882d4a9c0..4ce316552 100644 --- a/test/basicstuff.cpp +++ b/test/basicstuff.cpp @@ -207,7 +207,12 @@ struct casting_test { Matrix n = m.template cast(); for (int i = 0; i < m.rows(); ++i) { for (int j = 0; j < m.cols(); ++j) { - VERIFY_IS_APPROX(n(i, j), (internal::cast(m(i, j)))); + // Materialize both values to avoid GCC miscompilation at -O3 on some targets + // (e.g., loongarch64) where the compiler may keep intermediate results in wider + // FP registers, causing the comparison to see different precision than intended. + TgtScalar actual = n(i, j); + TgtScalar expected = internal::cast(m(i, j)); + VERIFY_IS_APPROX(actual, expected); } } }