[Bug c++/63389] New: Wrong warning about 64 bit integer constant overflow

ingo.josopait at gmx dot de gcc-bugzilla@gcc.gnu.org
Sat Sep 27 16:26:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63389

            Bug ID: 63389
           Summary: Wrong warning about 64 bit integer constant overflow
           Product: gcc
           Version: 4.9.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ingo.josopait at gmx dot de

Declaring the following constant creates a warning. I don't think it should.
-2^63 is the largest negative 64 bit integer value. The same warning appears
when compiling C language.


long i = -9223372036854775808L;   // equals -2^63



The compiler output is:

test.cpp:1:11: warning: integer constant is so large that it is unsigned
 long i = -9223372036854775808L;
           ^
test.cpp:1:1: warning: this decimal constant is unsigned only in ISO C90
 long i = -9223372036854775808L;



More information about the Gcc-bugs mailing list