This is the mail archive of the gcc-prs@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]
Other format: [Raw text]

other/7826: Decimal constant -2147483648 cause a warning "decimal constant is so large that it is unsigned"


>Number:         7826
>Category:       other
>Synopsis:       Decimal constant -2147483648 cause a warning "decimal constant is so large that it is unsigned"
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Sep 04 05:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     mark@austrics.com.au
>Release:        all releases
>Organization:
>Environment:
i686-gnu-linux
>Description:
gcc and g++, versions 2.95 up till and including 3.2
give a warning in the following case:

int const minInt = -2147483648;

~>gcc-3.2 troep.c
troep.c:3: warning: decimal constant is so large that it is unsigned

The result however is a negative number:

>How-To-Repeat:
~>cat troep.c
#include <stdio.h>

int const minInt = -2147483648;

int main(void)
{
  printf("%d\n", minInt);
  return (minInt < 0) ? 1 : 2;
}
~>gcc-3.2 troep.c
troep.c:3: warning: decimal constant is so large that it is unsigned
~>a.out; echo $?
-2147483648
1
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


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