This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/20019] incorrect overflow warning


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]