From 72166d0e6eaf12a99f449e26f402f926bef2bb50 Mon Sep 17 00:00:00 2001 From: Christoph Hertzberg Date: Wed, 18 Dec 2019 18:26:20 +0100 Subject: [PATCH] Fix some maybe-unitialized warnings --- Eigen/src/SparseCore/AmbiVector.h | 5 +++-- test/bdcsvd.cpp | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Eigen/src/SparseCore/AmbiVector.h b/Eigen/src/SparseCore/AmbiVector.h index e0295f2af..2cb7747cc 100644 --- a/Eigen/src/SparseCore/AmbiVector.h +++ b/Eigen/src/SparseCore/AmbiVector.h @@ -28,7 +28,7 @@ class AmbiVector typedef typename NumTraits::Real RealScalar; explicit AmbiVector(Index size) - : m_buffer(0), m_zero(0), m_size(0), m_allocatedSize(0), m_allocatedElements(0), m_mode(-1) + : m_buffer(0), m_zero(0), m_size(0), m_end(0), m_allocatedSize(0), m_allocatedElements(0), m_mode(-1) { resize(size); } @@ -147,7 +147,8 @@ template void AmbiVector<_Scalar,_StorageIndex>::init(int mode) { m_mode = mode; - if (m_mode==IsSparse) + // This is only necessary in sparse mode, but we set these unconditionally to avoid some maybe-uninitialized warnings + // if (m_mode==IsSparse) { m_llSize = 0; m_llStart = -1; diff --git a/test/bdcsvd.cpp b/test/bdcsvd.cpp index 85a80d6bb..ed35fc741 100644 --- a/test/bdcsvd.cpp +++ b/test/bdcsvd.cpp @@ -28,9 +28,11 @@ template void bdcsvd(const MatrixType& a = MatrixType(), bool pickrandom = true) { - MatrixType m = a; + MatrixType m; if(pickrandom) svd_fill_random(m); + else + m = a; CALL_SUBTEST(( svd_test_all_computation_options >(m, false) )); }