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++/20021] New: warning behavior depends on textual format of literal constant


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


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