public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: inouk@igt.net To: gcc-gnats@gcc.gnu.org Subject: c/4938: bad warnings about signed and unsigned Date: Mon, 19 Nov 2001 21:29:00 -0000 [thread overview] Message-ID: <20011124035237.4379.qmail@sourceware.cygnus.com> (raw) >Number: 4938 >Category: c >Synopsis: bad warnings about signed and unsigned >Confidential: no >Severity: non-critical >Priority: low >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Fri Nov 23 19:56:00 PST 2001 >Closed-Date: >Last-Modified: >Originator: inouk@igt.net >Release: unknown-1.0 >Organization: >Environment: Debian GNU/Linux GCC version 2.95 and 3.0 >Description: The range of signed int is between -2147483648 and 2147483647 unsigned int between 0 and 4294967295 here a sample code: 1 int main(void) { 2 3 unsigned int test; 4 int test1; 5 6 test = 4294967295; 7 test = 2147483648; 8 test = 2147483647; 9 10 test1 = 2147483647; 11 test1 = -2147483648; 12 test1 = -2147483647; 13 } I compile this and I have: gcc t2.c t2.c: In function `main': t2.c:6: warning: decimal constant is so large that it is unsigned t2.c:7: warning: decimal constant is so large that it is unsigned t2.c:11: warning: decimal constant is so large that it is unsigned I have a little difference with short, I never see warnings. signed short: -32768 to 32767 unsigned short: 0 to 65535 sample code: 1 int main(void) { 2 3 unsigned short test; 4 short test1; 5 6 test = 65535; 7 8 test1 = 65535; 9 test1 = 32767; 10 } nothing about warning. But, i "overflowed" test1 (in line 8). >How-To-Repeat: go to description >Fix: Better handling warnings :) >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2001-11-24 3:56 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2001-11-19 21:29 inouk [this message] 2001-11-20 0:16 jsm28 2001-11-20 1:06 jsm28 2002-07-22 13:17 neil
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20011124035237.4379.qmail@sourceware.cygnus.com \ --to=inouk@igt.net \ --cc=gcc-gnats@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).