From f2a6892bc240c3a177ea98de50467b74f3fb18b7 Mon Sep 17 00:00:00 2001 From: "corvid, Sebastian Geerken" Date: Sat, 19 Jul 2014 11:57:39 +0200 Subject: Fixed compiler warning. --- lout/misc.hh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lout') diff --git a/lout/misc.hh b/lout/misc.hh index 3082f33c..5aafd018 100644 --- a/lout/misc.hh +++ b/lout/misc.hh @@ -429,7 +429,19 @@ public: assert (i >= 0); return this->arrayMain + i; } else if (i >= this->startExtra + this->numExtra) { - assert (i < this->numMain + this->numExtra); + // The original assertion + /// + // "assert (i < this->numMain + this->numExtra)" + // + // causes this warnung in dw::Textblock::breakAdded: + // + // "assuming signed overflow does not occur when assuming that + // (X - c) > X is always false [-Wstrict-overflow]" + // + // Subtracting numExtra from both sides solves this, + // interrestingly. + + assert (i - this->numExtra < this->numMain); return this->arrayMain + i - this->numExtra; } else return this->arrayExtra1 + i - this->startExtra; -- cgit v1.2.3