From 64b1a153182ec4ce9976291c29db2099b30e77d8 Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Mon, 8 Oct 2018 12:01:18 +0200 Subject: [PATCH] Workaround stupid warning --- unsupported/Eigen/CXX11/src/Tensor/TensorScan.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h b/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h index 641366d9d..64f10d0a4 100644 --- a/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h +++ b/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h @@ -124,7 +124,11 @@ struct TensorEvaluator, Device> { m_stride = m_stride * dims[i]; } } else { - for (int i = NumDims - 1; i > op.axis(); --i) { + // dims can only be indexed through unsigned integers, + // so let's use an unsigned type to let the compiler knows. + // This prevents stupid warnings: ""'*((void*)(& evaluator)+64)[18446744073709551615]' may be used uninitialized in this function" + unsigned int axis = internal::convert_index(op.axis()); + for (unsigned int i = NumDims - 1; i > axis; --i) { m_stride = m_stride * dims[i]; } }