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

Ilya Mirsky via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 23 16:32:22 PST 2019


ilya updated this revision to Diff 235184.
ilya added a comment.

1. Refactor `CheckArrayAccess()` to take `AllowPastTheEnd` parameter to avoid a false positive array out-of-bounds warning for `&(cond ? arr1[N] : arr2[N])`.
2. Use `IgnoreParenCasts()` instead of `IgnoreParenImpCasts()` in `CheckArrayAccess()` to avoid false negatives when explicit cast is involved.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71714

Files:
  clang/include/clang/Sema/Sema.h
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Parser/cxx-ambig-decl-expr.cpp
  clang/test/SemaCXX/array-bounds.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D71714.235184.patch
Type: text/x-patch
Size: 7709 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20191224/0f727796/attachment-0001.bin>


More information about the cfe-commits mailing list