This is the mail archive of the
mailing list for the GCC project.
Re: -Warray-bounds false negative
On Fri, 13 Nov 2009, Andrew Pinski wrote:
On Fri, Nov 13, 2009 at 1:09 PM, Matt <firstname.lastname@example.org> wrote:
I recently came across a false negative in GCC's detection of array bounds
violation. At first, I thought the other tool (PC-Lint) was having false
positive, but it turns out to be correct. The false negative occurs in GCC
4.3, 4.4.1, and latest trunk (4.5). I'm curious to understand how exactly
the detection breaks down, as I think it may affect if/how the loop in
question is optimized.
Well in this case, all of the code is considered dead is removed
before the warning will happen to be emitted.
If I change it so that data is read from (instead of just written to),
the trunk warns about this code:
t.c:21:20: warning: array subscript is above array bounds
I changed the last return to be:
d'oh! Next time I'll look at the objdump output first.
Thanks for the quick explanation!
tangled strands of DNA explain the way that I behave.