This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/8268] no compile time array index checking


------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]