[cfe-commits] PATCH: Enhance array bounds checking
Ted Kremenek
kremenek at apple.com
Thu Jul 14 17:04:35 PDT 2011
On Jul 14, 2011, at 12:16 PM, Kaelyn Uhrain wrote:
> For clarification, which part of the restrictions I mentioned do you see as an ommision in the logic that need to be mentioned in comments with the patch to indicate they are intentional--given that Sema::CheckArrayAccess explicitly only works with an Expr of ConstantArrayType and a second Expr that must return true for isIntegerConstantExpr otherwise CheckArrayAccess doesn't have the two values it needs to perform the check, and given there is already a comment explaining the slight difference in acceptable values depending on whether the index value is an array subscript or a pointer-arithmetic offset?
I was thinking more of documenting design decisions. For example, documenting in the logic why "array + length" is okay and why "array + length + 1" is not. But you've already done this; so I think you're right that nothing more really needs to be done on that part. Thanks for your patience; I was gradually thinking it through.
The only other issue: should this be controlled under a separate warning flag, at least initially so we can experiment with this new warning and see how noisy it is? E.g. "-Warray-bounds-pointer-arithmetic".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20110714/f2dc265d/attachment.html>
More information about the cfe-commits
mailing list