public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: middle-end/6694: Warning that largest negative int -2147483648 in comparison is unsigned
@ 2002-05-17  7:13 sirl
  0 siblings, 0 replies; 4+ messages in thread
From: sirl @ 2002-05-17  7:13 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, nobody, rocky

Synopsis: Warning that largest negative int -2147483648 in comparison is unsigned

State-Changed-From-To: open->closed
State-Changed-By: sirl
State-Changed-When: Fri May 17 07:13:28 2002
State-Changed-Why:
    Not a bug. There are no negative constants in C.
    The constant overflows 'int' (thus the warning) and then the negation is applied as an operation.
    

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


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

* Re: middle-end/6694: Warning that largest negative int -2147483648 in comparison is unsigned
@ 2002-05-18 11:16 R. Bernstein
  0 siblings, 0 replies; 4+ messages in thread
From: R. Bernstein @ 2002-05-18 11:16 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR middle-end/6694; it has been noted by GNATS.

From: "R. Bernstein" <rocky@panix.com>
To: sirl@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: middle-end/6694: Warning that largest negative int -2147483648 in comparison is unsigned
Date: Sat, 18 May 2002 14:11:01 -0400

 Ooops the highlighting should be on "positive" 
  >   warning: positive decimal constant is so large that it is unsigned
  >            ^^^^^^^^


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

* Re: middle-end/6694: Warning that largest negative int -2147483648 in comparison is unsigned
@ 2002-05-18 11:06 R. Bernstein
  0 siblings, 0 replies; 4+ messages in thread
From: R. Bernstein @ 2002-05-18 11:06 UTC (permalink / raw)
  To: nobody; +Cc: gcc-prs

The following reply was made to PR middle-end/6694; it has been noted by GNATS.

From: "R. Bernstein" <rocky@panix.com>
To: sirl@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org,
	rocky@panix.com, gcc-gnats@gcc.gnu.org
Cc:  
Subject: Re: middle-end/6694: Warning that largest negative int -2147483648 in comparison is unsigned
Date: Sat, 18 May 2002 14:03:58 -0400

  > State-Changed-Why:
  >     Not a bug. There are no negative constants in C.
  >     The constant overflows 'int' (thus the warning) and then the negation is applied as an operation.
 
 
 I think there would be less confusion then if the warning message were
 changed to
 
   warning: positive decimal constant is so large that it is unsigned
                     ^^^^^^^
 
 Or even better 
 
   warning: positive decimal constant 2147483648 is so large that it is unsigned
 
 (where 2147483648 is of course substituted in from the offending value).


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

* middle-end/6694: Warning that largest negative int -2147483648 in comparison is unsigned
@ 2002-05-17  6:06 rocky
  0 siblings, 0 replies; 4+ messages in thread
From: rocky @ 2002-05-17  6:06 UTC (permalink / raw)
  To: gcc-gnats; +Cc: rocky


>Number:         6694
>Category:       middle-end
>Synopsis:       Warning that largest negative int -2147483648 in comparison is unsigned
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Fri May 17 06:06:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     R. Bernstein
>Release:        3.1, 3.0.4, and  "RedHat 2.9.6"
>Organization:
>Environment:
System: Linux muffin.peccary.sty 2.4.19-pre7-ac2 #2 Wed Apr 24 03:54:19 EDT 2002 i686 unknown
Architecture: i686

host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../configure 
>Description:
The warning 
	warning: decimal constant is so large that it is unsigned
is given when the largest negative 32-bit value used in a comparison is used. I think the code generated is correct for i686, but there may be some architectures which for which signed comparisons and unsigned comparisons generate different code
>How-To-Repeat:
run 
  gcc -o bug gcc-large-negative-warn-bug.c 
and should see:
gcc-large-negative-warn-bug.c: In function `main':
gcc-large-negative-warn-bug.c:11: warning: decimal constant is so large that it is unsigned
Check that code is correct. (The program is very short)
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="gcc-large-negative-warn-bug.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="gcc-large-negative-warn-bug.c"

I2luY2x1ZGUgPHN0ZGlvLmg+CmludAptYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgCnsKICAv
KiBUaGUgYmVsb3cgbGluZSBpcyB0byB2ZXJpZnkgdGhhdCB0aGlzIG51bWJlciBhIGxhcmdlIG5l
Z2F0aXZlIG51bWJlciAKICAgICBvbiB5b3VyIGFyY2hpdGVjdHVyZS4gKi8KICBwcmludGYoIiVs
ZFxuIiwgMHg4MDAwMDAwMCk7CiAgLyogQ2hlY2sgdGhhdCB0aGUgYWJvdmUgb3V0cHV0IG1hdGNo
ZXMgdGhlIHZhbHVlIGJlbG93IG9uIHlvdXIgYXJjaGl0ZWN0dXJlLgogICAgIEkgZG9uJ3QgYmVs
aWV2ZSBhIHdhcm5pbmcgc2hvdWxkIGJlIGNyZWF0ZWQgZm9yIHRoZSB2YWx1ZSBiZWxvdy4KICAq
LyAgCiAgaWYgKGFyZ2MgPT0gLTIxNDc0ODM2NDgpIHsKICAgIHByaW50ZigiY2FuJ3QgcmVhbGx5
IGhhcHBlblxuIik7CiAgfQp9Cgo=


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

end of thread, other threads:[~2002-05-18 18:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-17  7:13 middle-end/6694: Warning that largest negative int -2147483648 in comparison is unsigned sirl
  -- strict thread matches above, loose matches on Subject: below --
2002-05-18 11:16 R. Bernstein
2002-05-18 11:06 R. Bernstein
2002-05-17  6:06 rocky

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).