in: #include <cstddef> static const signed char lwb = 0x80; static const signed char lwba = -128; static const signed char upb = 127; static const size_t cnta = upb - lwba; static const size_t cnt = upb - lwb; int main() { return 0; } the two variables lwb and lwba are of identical type and numeric value. However, the compiler gives: ~/ootbc/common/src$ g++ foo.cc foo.cc:7: warning: integer overflow in expression i.e. only warning on the use of lwb (reordering does not change this). It should warn on both or (correctly) neither. This bug is related to bug #20019
This does not warn for me on the mainline.
Fixed in 4.1.0 and above.