diff --git a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp --- a/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp +++ b/mlir/lib/ExecutionEngine/SparseTensorUtils.cpp @@ -885,7 +885,7 @@ 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]);