[PATCH] D88174: [Sema] Address-space sensitive check for unbounded arrays (v2)

Chris Hamilton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 11:31:31 PDT 2020


chrish_ericsson_atx created this revision.
chrish_ericsson_atx added reviewers: aaron.ballman, rsmith.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
chrish_ericsson_atx requested review of this revision.

Check applied to unbounded (incomplete) arrays and pointers to spot
cases where the computed address is beyond the largest possible
addressable extent of the array, based on the address space in which the
array is delcared, or which the pointer refers to.

Check helps to avoid cases of nonsense pointer math and array indexing
which could lead to linker failures or runtime exceptions.  Of
particular interest when building for embedded systems with small
address spaces.

This is version 2 of this patch -- version 1 had some testing issues
due to a sign error in existing code.  That error is corrected and
lit test for this chagne is extended to verify the fix.

Originally reviewed/accepted by: aaron.ballman
Original revision: https://reviews.llvm.org/D86796


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D88174

Files:
  clang/include/clang/Basic/DiagnosticSemaKinds.td
  clang/lib/Sema/SemaChecking.cpp
  clang/test/Sema/const-eval.c
  clang/test/Sema/unbounded-array-bounds.c
  clang/test/SemaCXX/constant-expression-cxx1y.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88174.293815.patch
Type: text/x-patch
Size: 12891 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200923/140612c3/attachment-0001.bin>


More information about the cfe-commits mailing list