[PATCH] D144136: Add a "remark" to report on array accesses
Bill Wendling via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 26 14:07:12 PDT 2023
void added a comment.
In D144136#4639907 <https://reviews.llvm.org/D144136#4639907>, @kees wrote:
> Can you refresh this patch to work with https://reviews.llvm.org/D148381 ? My testing seems to imply that it doesn't know the size of the array. I assume the `if (!IsUnboundedArray)` check is incomplete now. i.e. for a `__counted_by` array, I see the "unknown" remark:
>
> array-bounds.c:341:2: remark: accessing unknown sized array by 'index - 1' [-Rarray-bounds]
> 341 | TEST_ACCESS(p, array, index, SHOULD_TRAP);
> | ^
>
> which is from the `array-bounds.c` test cases:
>
> TEST_SIGNAL(counted_by_enforced_by_sanitizer, SIGILL)
> {
> struct annotated *p;
> int index = MAX_INDEX + unconst;
>
> p = alloc_annotated(index);
>
> REPORT_SIZE(p->array);
> TEST_ACCESS(p, array, index, SHOULD_TRAP);
> }
Are you going to be okay with something like this:
array-bounds.c:341:2: remark: accessing 'sizeof(p) + p->count * sizeof(*p->array)' sized array by 'index - 1' [-Rarray-bounds]
341 | TEST_ACCESS(p, array, index, SHOULD_TRAP);
| ^
or can it be simplified into something like this:
array-bounds.c:341:2: remark: accessing flexible array, counted by 'count', with 'index - 1' [-Rarray-bounds]
341 | TEST_ACCESS(p, array, index, SHOULD_TRAP);
| ^
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144136/new/
https://reviews.llvm.org/D144136
More information about the cfe-commits
mailing list