[Mlir-commits] [mlir] ef83515 - [MLIR] Simplex::findPivotRow: silence spurious coverity warning
Arjun P
llvmlistbot at llvm.org
Thu Jan 6 05:48:42 PST 2022
Author: Arjun P
Date: 2022-01-06T19:18:30+05:30
New Revision: ef8351598ef33b906fd1962420c8b464812cea85
URL: https://github.com/llvm/llvm-project/commit/ef8351598ef33b906fd1962420c8b464812cea85
DIFF: https://github.com/llvm/llvm-project/commit/ef8351598ef33b906fd1962420c8b464812cea85.diff
LOG: [MLIR] Simplex::findPivotRow: silence spurious coverity warning
Initialize some variables to zero to avoid a warning about them possibly being
used uninitialized. In actuality, they will never be used before initialization.
Added:
Modified:
mlir/lib/Analysis/Presburger/Simplex.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Analysis/Presburger/Simplex.cpp b/mlir/lib/Analysis/Presburger/Simplex.cpp
index ad1e019ded3d..d00832b21ef8 100644
--- a/mlir/lib/Analysis/Presburger/Simplex.cpp
+++ b/mlir/lib/Analysis/Presburger/Simplex.cpp
@@ -308,7 +308,11 @@ Optional<unsigned> SimplexBase::findPivotRow(Optional<unsigned> skipRow,
Direction direction,
unsigned col) const {
Optional<unsigned> retRow;
- int64_t retElem, retConst;
+ // Initialize these to zero in order to silence a warning about retElem and
+ // retConst being used uninitialized in the initialization of `
diff ` below. In
+ // reality, these are always initialized when that line is reached since these
+ // are set whenever retRow is set.
+ int64_t retElem = 0, retConst = 0;
for (unsigned row = nRedundant; row < nRow; ++row) {
if (skipRow && row == *skipRow)
continue;
More information about the Mlir-commits
mailing list