This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20019] incorrect overflow warning
- From: "igodard at pacbell dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 17 Feb 2005 03:09:19 -0000
- Subject: [Bug c++/20019] incorrect overflow warning
- References: <20050217025913.20019.igodard@pacbell.net>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From igodard at pacbell dot net 2005-02-17 03:09 -------
Turns out that the promotion rules aren't the problem, because you still get the
same message even with *explicit* promotion - the code:
#include <cstddef>
static const char lwb = 0x80;
static const char upb = 0x7f;
static const size_t cnt = int(upb) - int(lwb) + 1;
int main() {
return 0;
}
gets you:
~/ootbc/common/src$ c++ foo.cc
foo.cc:5: warning: integer overflow in expression
which *has* to be wrong regardless of the promotion rules.
Ivan
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20019