This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Gcc/g++ bug report: decimal constant too large
- To: <gcc-bugs at gcc dot gnu dot org>
- Subject: Gcc/g++ bug report: decimal constant too large
- From: Tomas Kalibera <tkal6255 at ss1000 dot ms dot mff dot cuni dot cz>
- Date: Fri, 31 Aug 2001 13:38:48 +0200 (CEST)
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