Skip to content

Commit ef83515

Browse files
committed
[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.
1 parent ddd9ec6 commit ef83515

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

mlir/lib/Analysis/Presburger/Simplex.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,11 @@ Optional<unsigned> SimplexBase::findPivotRow(Optional<unsigned> skipRow,
308308
Direction direction,
309309
unsigned col) const {
310310
Optional<unsigned> retRow;
311-
int64_t retElem, retConst;
311+
// Initialize these to zero in order to silence a warning about retElem and
312+
// retConst being used uninitialized in the initialization of `diff` below. In
313+
// reality, these are always initialized when that line is reached since these
314+
// are set whenever retRow is set.
315+
int64_t retElem = 0, retConst = 0;
312316
for (unsigned row = nRedundant; row < nRow; ++row) {
313317
if (skipRow && row == *skipRow)
314318
continue;

0 commit comments

Comments
 (0)