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]

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


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



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