This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/20021] New: warning behavior depends on textual format of literal constant
- 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 08:46:12 -0000
- Subject: [Bug c++/20021] New: warning behavior depends on textual format of literal constant
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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