[PATCH] D71714: [Sema] Fix -Warray-bounds false negative when casting an out-of-bounds array item
Richard Smith - zygoloid via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 19 12:54:55 PST 2019
rsmith added a comment.
In addition to @riccibruno's comment, I found a couple of other suspicious things nearby (unrelated to the fix in this patch). No need to address them in this patch unless you feel motivated :)
================
Comment at: clang/lib/Sema/SemaChecking.cpp:13384
case Stmt::MemberExprClass: {
expr = cast<MemberExpr>(expr)->getBase();
break;
----------------
Hmm, don't we need to do different things for dot and arrow in this case?
================
Comment at: clang/lib/Sema/SemaChecking.cpp:13413
if (const Expr *lhs = cond->getLHS())
CheckArrayAccess(lhs);
if (const Expr *rhs = cond->getRHS())
----------------
Doesn't this need to preserve the `AllowOnePastEnd` value to avoid a false positive for `&(cond ? arr1[N] : arr2[N])`?
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