|
From: Julian S. <js...@ac...> - 2011-03-26 07:14:42
|
> 1. Using a constant index value for an array on the stack resulting in > an invalid access. I got from the documentation that the first access > has to be valid; my code does that. I've noticed that detection works OK > in for loop, but, when unrolled (for example when using -O2 option for > optimization in GCC), exp-ptrcheck doesn't detect errors. Well, at least, it doesn't detect to many errors when loop unrolling is done. That doesn't surprise me, because it means accesses to memory in the loop is spread over more instructions, and so there is increased probability of each instruction only being used once, especially if the loop is unrolled completely. > int s[5]; > s[4] = 42; > s[5] = 42; // nothing happens > > 2. Another case when it cannot detect the error is when using memset: > > char y[5]; > memset(y, 'a', 10); > > 3. Another thing I've noticed is that it doesn't correctly report > errors when using variable length arrays (it reports errors all the > time, even when used correctly). Variable length arrays, hmm. I guess there is no description in Dwarf for the size of the array, or at least they are described as having a non-constant size (just guessing). I can imagine that this doesn't get checked properly. J |