diff --git a/src/lte/model/lte-asn1-header.cc b/src/lte/model/lte-asn1-header.cc index 095512525..767d30970 100644 --- a/src/lte/model/lte-asn1-header.cc +++ b/src/lte/model/lte-asn1-header.cc @@ -321,7 +321,14 @@ void Asn1Header::SerializeChoice (int numOptions, int selectedOption, bool isExt void Asn1Header::SerializeInteger (int n, int nmin, int nmax) const { - NS_ASSERT_MSG (nmin <= n && n <= nmax, + // The following is equivalent to: + // NS_ASSERT_MSG (nmin <= n && n <= nmax, + // "Integer " << n << " is outside range [" << nmin << ", " << nmax << "]"); + // This is a workaround to gcc-7 aggressive optimization, see #346, and can be dropped + // once gcc-7 will not be anymore supported. + long int nComp = nmin; + nComp -= n; + NS_ASSERT_MSG (nComp <= 0 && n <= nmax, "Integer " << n << " is outside range [" << nmin << ", " << nmax << "]"); // Clause 11.5.3 ITU-T X.691