[PATCH] D71714: [Sema] Fix -Warray-bounds false negative when casting an out-of-bounds array item

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 20 14:30:03 PST 2019


efriedma added a comment.

> and it seems to involve a lot of AST traversal

I was thinking we'd just call into SemaChecking in appropriate places.  I guess there's a little AST traversal to figure whether an expression forms an array address.  Your idea seems simpler.

> remove elements from the list of deferred warnings when handling an & operator

For C++, I think you might also need to handle discarded-value expressions?  Maybe it's okay if we warn anyway in that case. :)

> This would lose the warnings on *&x[n], but I don't think that's a disaster

And more generally `*(x+n)`, although I guess that isn't implemented now anyway.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D71714/new/

https://reviews.llvm.org/D71714





More information about the cfe-commits mailing list