public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* other/7826: Decimal constant -2147483648 cause a warning "decimal constant is so large that it is unsigned"
@ 2002-09-04  5:26 carlo
  0 siblings, 0 replies; 2+ messages in thread
From: carlo @ 2002-09-04  5:26 UTC (permalink / raw)
  To: gcc-gnats


>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:


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: other/7826: Decimal constant -2147483648 cause a warning "decimal constant is so large that it is unsigned"
@ 2002-09-04  5:37 nathan
  0 siblings, 0 replies; 2+ messages in thread
From: nathan @ 2002-09-04  5:37 UTC (permalink / raw)
  To: carlo, gcc-bugs, gcc-prs, nobody

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

State-Changed-From-To: open->closed
State-Changed-By: nathan
State-Changed-When: Wed Sep  4 05:37:45 2002
State-Changed-Why:
    not a bug. -2147483648 is an expression consisting of unary
    minus applied to an integer literal. on 32 bit systems, that
    literal will have the type *unsigned* and value 2147483648

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7826


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-04 12:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-04  5:26 other/7826: Decimal constant -2147483648 cause a warning "decimal constant is so large that it is unsigned" carlo
2002-09-04  5:37 nathan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).