[Bug c/8268] no compile time array index checking
trt at acm dot org
gcc-bugzilla@gcc.gnu.org
Tue Jun 21 15:55:00 GMT 2005
------- Additional Comments From trt at acm dot org 2005-06-21 15:55 -------
Since there is mudflap, it is especially important to avoid false positives.
One type occurs in code that never actually executes, e.g. conditional lookup:
#define LOOKUP(i) (i < XSIZE ? x[i]: 0)
To defend against that, issue the warning only if skip_evaluation is zero.
(For a more general fix, see http://gcc.gnu.org/ml/gcc/2004-10/msg00859.html)
Another is taking the address one past the last element, e.g.
int a[10];
int *aend = &a[10]; // this is perfectly valid, and common
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=8268
More information about the Gcc-bugs
mailing list