This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
-Warray-bounds issue
- From: Matt Hargett <matt at use dot net>
- To: gcc at gcc dot gnu dot org
- Date: Mon, 23 Jul 2007 11:44:56 -0700
- Subject: -Warray-bounds issue
Hi,
I'll be teaching a class this week on code analysis and I wanted to
demonstrate GCC 4.3's new array bounds analysis capabilities.
Unfortunately, I can't seem to get the new array bounds warnings to appear in
gcc-4.3-20070720 using the commandline of '-O2 -Warray-bounds' with either of
the following code:
#include <stdlib.h>
int main(int argc, char **argv)
{
size_t size = 16;
char p[size];
p[16] = 0;
}
--
#include <stdlib.h>
int main(int argc, char **argv)
{
char p[16];
p[16] = 0;
}
--
I have tried making the overflow more pronounced, using -O3, and various other
things. I bootstrapped from the sources, but there didn't appear to be any
special configure switch I was supposed to apply. I did a profiledbootstrap.
If someone could help me figure out what I'm doing wrong, or if I should use
an older snapshot, that would be great. I am really excited about the
increased quality this has the capability to bring to all open source
applications!
Thanks in advance for any help!