Gcc/g++ bug report: decimal constant too large

Tomas Kalibera tkal6255@ss1000.ms.mff.cuni.cz
Fri Aug 31 04:38:00 GMT 2001


The bug being reported is that warning "decimal constant is so large that
it
is unsigned" is issued by gcc for integer constant - 2^31 - 1
(-2147483648),
although it is a valid integer constant (because it equals to INT_MIN from
limits.h).
g++ behaves simmilarly. The generated code is correct for both g++ and
gcc.

$ gcc -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)

$ g++ -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.2/specs
gcc version 2.95.2 20000220 (Debian GNU/Linux)

$ cat l.c
#include<limits.h>
#include<stdio.h>

int i = -2147483648;

int main(void) {
        printf("%d\n",i);
        return 0;
}

$ gcc l.c
l.c:4: warning: decimal constant is so large that it is unsigned

$ ./a.out
-2147483648

$ g++ l.c
l.c:4: warning: decimal integer constant is so large that it is unsigned

$ ./a.out
-2147483648

$ uname -a
Linux bobcasys 2.2.14 #18 Mon Dec 25 20:42:31 CET 2000 i586 unknown

GNU/Debian Linux 2.2r0 (potato)


Tomas Kalibera




More information about the Gcc-bugs mailing list