From 3b13f8805c0225046558b7c6657860f39f4e78f9 Mon Sep 17 00:00:00 2001 From: Aart Bik Date: Thu, 19 May 2022 12:23:52 -0700 Subject: [PATCH] [mlir][sparse] fix unsigned comparison bug in assert Reviewed By: bixia, wrengr Differential Revision: https://reviews.llvm.org/D126007 --- mlir/lib/ExecutionEngine/SparseTensorUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp index 24d77a6..21ad815 100644 --- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp +++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp @@ -885,7 +885,7 @@ private: const uint64_t pstop = static_cast(pointers_d[parentPos + 1]); // Loop-invariant code for looking up the `d`-level coordinates/indices. const std::vector &indices_d = src.indices[d]; - assert(pstop - 1 < indices_d.size() && "Index position is out of bounds"); + assert(pstop <= indices_d.size() && "Index position is out of bounds"); uint64_t &cursor_reord_d = this->cursor[this->reord[d]]; for (uint64_t pos = pstart; pos < pstop; pos++) { cursor_reord_d = static_cast(indices_d[pos]); -- 2.7.4