From: "Lars Gullik Bjønnes" <larsbj@gullik.org>
To: gcc-help@gcc.gnu.org
Subject: False positive from -Warray-bounds?
Date: Thu, 29 Dec 2011 22:02:00 -0000 [thread overview]
Message-ID: <CAOYg4AyWZLaxMcvcj9NewAq8XjxXpsTbr7mVOwZ+a_-DSK4eqA@mail.gmail.com> (raw)
I have this code:
--------------
unsigned int f(unsigned int value)
{
unsigned int i = (value & 0xffff);
return (i == 0xffff ? 0xffffffff : i);
}
static int *arr1[10];
void t(unsigned int s)
{
arr1[f(s)] = 0;
arr1[f(s)] = 0;
}
------------------
When compiled with 'gcc -Wall -Wextra -c' I get a warning about
"subscript is above array bounds".
Shouldn't the -Warray-bounds only warn if will _always_ be out-of-bounds?
Is this a false positive, or is there something that I am completely missing?
I see this with gcc from trunk (some days ago), and with redhat gcc 4.6.2-1.
--
Lgb
next reply other threads:[~2011-12-29 21:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-29 22:02 Lars Gullik Bjønnes [this message]
2011-12-29 22:45 ` Ian Lance Taylor
2011-12-29 23:03 ` Lars Gullik Bjønnes
2011-12-29 23:57 ` Ian Lance Taylor
2011-12-30 0:16 ` Vincent Lefevre
2011-12-30 0:21 ` Vincent Lefevre
2011-12-30 0:38 ` Ian Lance Taylor
2011-12-30 5:00 ` Vincent Lefevre
2011-12-30 8:29 ` Ian Lance Taylor
2011-12-30 12:08 ` David Brown
2011-12-30 19:44 ` Vincent Lefevre
2011-12-29 23:24 ` Vincent Lefevre
2011-12-30 0:19 ` Ian Lance Taylor
2011-12-29 23:17 ` Vincent Lefevre
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=CAOYg4AyWZLaxMcvcj9NewAq8XjxXpsTbr7mVOwZ+a_-DSK4eqA@mail.gmail.com \
--to=larsbj@gullik.org \
--cc=gcc-help@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: link
Be 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).