Skip to content
This repository was archived by the owner on Nov 17, 2023. It is now read-only.

Commit 0a0a31e

Browse files
committed
address the comment
1 parent 646e0ba commit 0a0a31e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

include/mxnet/tuple.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ class Tuple {
200200
*/
201201
inline ValueType& operator[](int i) {
202202
// it fixes the false alarm of assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Werror=strict-overflow]
203-
#pragma GCC diagnostic push
204-
#pragma GCC diagnostic ignored "-Wstrict-overflow"
205-
CHECK(i >= 0 && i < ndim()) << "index = " << i << " must be in range [0, " << ndim() << ")";
206-
#pragma GCC diagnostic pop
203+
#pragma GCC diagnostic push
204+
#pragma GCC diagnostic ignored "-Wstrict-overflow"
205+
CHECK(i >= 0 && i < ndim()) << "index = " << i << " must be in range [0, " << ndim() << ")";
206+
#pragma GCC diagnostic pop
207207
return begin()[i];
208208
}
209209
/*!
@@ -212,7 +212,11 @@ class Tuple {
212212
* \return the corresponding dimension size
213213
*/
214214
inline const ValueType& operator[](int i) const {
215+
// it fixes the false alarm of assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Werror=strict-overflow]
216+
#pragma GCC diagnostic push
217+
#pragma GCC diagnostic ignored "-Wstrict-overflow"
215218
CHECK(i >= 0 && i < ndim()) << "index = " << i << " must be in range [0, " << ndim() << ")";
219+
#pragma GCC diagnostic pop
216220
return begin()[i];
217221
}
218222
/*!

0 commit comments

Comments
 (0)