Skip to content

Commit 90350e6

Browse files
authored
Fix warning on parentheses around ‘&&’ within ‘||’ (#4100)
Fixes the following warning when compiling with gcc 11.4: ``` torch-mlir/lib/Dialect/Torch/IR/TorchOps.cpp:4111:42: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] 4111 | (stride < 0 && begin > limit) && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ 4112 | "aten.slice.Tensor iteration args are statically invalid."); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ```
1 parent 0189977 commit 90350e6

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/Dialect/Torch/IR/TorchOps.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4107,9 +4107,8 @@ OpFoldResult AtenSliceTensorOp::fold(FoldAdaptor adaptor) {
41074107
limit = limit < 0 ? limit + inType.getSizes()[dimInt] : limit;
41084108
limit = limit < 0 ? -1 : limit;
41094109
limit = std::min(limit, inType.getSizes()[dimInt]);
4110-
assert((stride > 0 && begin < limit) ||
4111-
(stride < 0 && begin > limit) &&
4112-
"aten.slice.Tensor iteration args are statically invalid.");
4110+
assert(((stride > 0 && begin < limit) || (stride < 0 && begin > limit)) &&
4111+
"aten.slice.Tensor iteration args are statically invalid.");
41134112

41144113
int64_t inputRank = inType.getSizes().size();
41154114
llvm::SmallVector<int64_t> inputStrides(inputRank, 1);

0 commit comments

Comments
 (0)