[PATCH] D96976: [analyzer] Fix reinterpret_cast handling for pointer-to-member
Deep Majumder via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 17 00:35:25 PDT 2021
RedDocMD added a comment.
@steakhal, being picky with code from beginners is a good way to train them to write code I think, and so I must thank you for you scrutiny!
As for the test you pointed out, it is a wrong test. It is wrong now that I have a better understanding of the problem.
There are two options that can be taken I reckon:
- Simply make the stored `SVal` `Unknown` when we have a reinterpret-cast on pointer-to-member
- Model it properly to take care of all the semantics.
Both of them remove the bug. I would prefer the first one and leave a TODO for better modelling. Better modelling necessarily makes interpretation of pointer-to-member clumsy. Because previously, a pointer-to-member was always valid. If we include modelling for reinterpret-cast, then as far as I can see, the pointer-to-member may either be in a valid or invalid state. This would lead to a chain of other changes. Possible most certainly but I think a tad bit unnecessary, especially because this corner case makes the normal case handling more complex
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96976/new/
https://reviews.llvm.org/D96976
More information about the cfe-commits
mailing list