[PATCH] D107051: [clang][analyzer] Improve bug report in alpha.security.ReturnPtrRange
Balázs Benics via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 5 07:58:29 PDT 2021
steakhal added a comment.
In D107051#2928536 <https://reviews.llvm.org/D107051#2928536>, @balazske wrote:
> If the original memory object is not known the static size is not known too. Every pointer with unknown source can point into a bigger data structure.
You are right, but IMO pointers to arrays are so rare that we could probably trust them. At least, that was my idea.
================
Comment at: clang/test/Analysis/return-ptr-range.cpp:11
+int *test_global_ptr() {
+ do { // expected-note{{Loop condition is false. Exiting loop}}
int x = conjure_index();
----------------
balazske wrote:
> steakhal wrote:
> > I would rather use a simple block `{...}` for opening a scope, but I don't know why you don't declare `ptr` in the original scope in the first place.
> > People usually use `do {} while(0)` constructs if they want to use `break` somewhere ~~ like a `goto` OR they implement a macro. You are doing none of these.
> I do not know why these loops are here but did not change the original code. Should we change it to simple block?
Yes, please. The note for the loop is only noise in its current form.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D107051/new/
https://reviews.llvm.org/D107051
More information about the cfe-commits
mailing list