[PATCH] D136671: [analyzer] Fix crash for array-delete of UnknownVal values.
Tomasz KamiĆski via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Oct 25 04:51:23 PDT 2022
tomasz-kaminski-sonarsource added a comment.
In D136671#3882166 <https://reviews.llvm.org/D136671#3882166>, @isuckatcs wrote:
>> This eliminate the crash in `getDynamicElementCount` on that region
>
> I think that if the crash comes from `getDynamicElementCount`, we should address it there too, so
> when the function is called elsewhere under the same circumstances it won't crash again.
>
> What do you think?
Good point .
I was also wondering about it and went for the current approach or preserving the precondition that the passed region cannot be null, because:
- For other uses of `prepareStateForArrayDestruction` in case of automatic variables or members, the destroyed should be always known, so this precondition makes sense. In this context `delete[] p` of unknown pointer is special case, so localized handling made sense.
- This case of `ArgR` being null was already handled in the code, so extending it seemed to be more consistent.
Does it make sense to you?
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D136671/new/
https://reviews.llvm.org/D136671
More information about the cfe-commits
mailing list