From 4284c68fbb81cb069a630ae1bf4a953ee922f6e5 Mon Sep 17 00:00:00 2001 From: Minh Quan HO Date: Mon, 4 Oct 2021 18:30:26 +0200 Subject: [PATCH] nestbyvalue test: fix uninitialized matrix - Doing computation with uninitialized (zero-ed ? but thanks Linux) matrix, or worse NaN on other non-linux systems. - This commit fixes it by initializing to Random(). --- test/nestbyvalue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nestbyvalue.cpp b/test/nestbyvalue.cpp index c5356bc24..3a86bea50 100644 --- a/test/nestbyvalue.cpp +++ b/test/nestbyvalue.cpp @@ -26,7 +26,7 @@ EIGEN_DECLARE_TEST(nestbyvalue) for(int i = 0; i < g_repeat; i++) { Index rows = internal::random(1,EIGEN_TEST_MAX_SIZE); Index cols = internal::random(1,EIGEN_TEST_MAX_SIZE); - MatrixXd a = MatrixXd(rows,cols); + MatrixXd a = MatrixXd::Random(rows,cols); nb_temporaries = 0; XprType x = get_xpr_with_temps(a); VERIFY_IS_EQUAL(nb_temporaries,6);