[cfe-commits] PATCH: Enhance array bounds checking

David Blaikie dblaikie at gmail.com
Thu Jul 14 10:54:29 PDT 2011


> Your math is off-by-one; Foo+4 is legal, Foo+5 is not.
>

Ah, right, sorry - 4 elements, zero index, etc... thanks for the catch.

(case in point, I suppose)

So, yes, two different cases - one past the end should be silent, unless
provably dereferenced. Everything else... either silent if not proven to be
dereferenced, or a separate warning class (if LLVM is already relying on
this UB for optimizations then a warning does seem appropriate).

- David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110714/d933a27c/attachment.html>


More information about the cfe-commits mailing list