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

-- 
           Summary: warning behavior depends on textual format of literal
                    constant
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: igodard at pacbell dot net
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20021

Reply via email to