From: Jeffrey A Law <law@cygnus.com>
To: Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
Cc: gcc@gcc.gnu.org
Subject: Re: Array out of bounds warning
Date: Mon, 31 Jul 2000 07:11:00 -0000 [thread overview]
Message-ID: <15088.965052644@upchuck> (raw)
In-Reply-To: <87d7jv8i9p.fsf@student.uni-tuebingen.de>
In message < 87d7jv8i9p.fsf@student.uni-tuebingen.de >you write:
> Hi,
>
> the Compaq C compiler has a warning for an array out of bounds access
> with constant index (and known array size, of course), like this:
>
> int a[10];
> a[10] = 17;
>
> I've already discovered two nasty bugs with this warning, so I
> wondered whether it might be worth adding it to gcc. It can be
> erroneously triggered with code that allocates extra space after the
> array, for example by putting it into a union. These arrays usually
> have a size of 1, so the Compaq C compiler has a special warning for
> that which can be toggled seperately. I'd rather never warn in this
> condition, so I suggest something like this:
It might make more sense to put this in expr.c so that other languages
can get similar checks. You might also check that the low bound is within
range.
The next question in my mind is how often do we get false hits on the
warning.
But I generally like the idea of issuing a warning if the code is obviously
wrong.
jeff
next prev parent reply other threads:[~2000-07-31 7:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-07-30 14:16 Falk Hueffner
2000-07-31 7:11 ` Jeffrey A Law [this message]
2000-07-31 11:19 ` Falk Hueffner
2000-08-02 14:59 ` Kamil Iskra
2000-08-02 18:12 ` Geoff Keating
2000-08-03 0:59 ` Kamil Iskra
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=15088.965052644@upchuck \
--to=law@cygnus.com \
--cc=falk.hueffner@student.uni-tuebingen.de \
--cc=gcc@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).