From a88171555ba0265e29c1737bd00e9b85ec1cbb97 Mon Sep 17 00:00:00 2001 From: stu1130 Date: Thu, 29 Aug 2019 18:21:37 -0700 Subject: [PATCH] address the comment --- include/mxnet/tuple.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/mxnet/tuple.h b/include/mxnet/tuple.h index 52efdcdce6fb..51f860995e74 100644 --- a/include/mxnet/tuple.h +++ b/include/mxnet/tuple.h @@ -199,10 +199,11 @@ class Tuple { * \return the corresponding dimension size */ inline ValueType& operator[](int i) { - // it fixes the false alarm of assuming signed overflow does not occur when assuming that (X - c) > X is always false [-Werror=strict-overflow] + // it fixes the false alarm of assuming signed overflow does not occur + // when assuming that (X - c) > X is always false [-Werror=strict-overflow] #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wstrict-overflow" - CHECK(i >= 0 && i < ndim()) << "index = " << i << " must be in range [0, " << ndim() << ")"; + CHECK(i >= 0 && i < ndim()) << "index = " << i << " must be in range [0, " << ndim() << ")"; #pragma GCC diagnostic pop return begin()[i]; } @@ -212,7 +213,12 @@ class Tuple { * \return the corresponding dimension size */ inline const ValueType& operator[](int i) const { + // it fixes the false alarm of assuming signed overflow does not occur + // when assuming that (X - c) > X is always false [-Werror=strict-overflow] + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstrict-overflow" CHECK(i >= 0 && i < ndim()) << "index = " << i << " must be in range [0, " << ndim() << ")"; + #pragma GCC diagnostic pop return begin()[i]; } /*!