[clang] [analyzer] Fix StackAddrEscapeChecker crash on temporary object fields (PR #66493)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 15 05:42:09 PDT 2023
================
@@ -398,7 +400,7 @@ void StackAddrEscapeChecker::checkEndFunction(const ReturnStmt *RS,
}(Referrer->getMemorySpace());
// This cast supposed to succeed.
----------------
steakhal wrote:
I was thinking about it once you raised this comment.
To me, to have a proper diagnostic we need something that we can name here; and they are usually variables.
Now, if we check and bail out if it's not a VarRegion, we would not get notified if we suddenly have some other value that we could cover but we don't. It took a long time to even hit this crash, so I don't think they are too frequent.
So the question is which we prefer:
- Crash (possible in the long future) to get notified or
- Silently ignore these unthought, interesting cases for which we didn't account for
If this would be a mission-critical software I'd vote for (2), but now I'm a bit hesitant in between the two options.
Maybe, given that this is a core checker, we should lean towards gracefully handling this. WDYT?
https://github.com/llvm/llvm-project/pull/66493
More information about the cfe-commits
mailing list