It turns out that we crash all over the place when we try to evaluate destructors over concrete-int-but-not-null locations.
Add some defensive code.
Paths
| Differential D65349
[analyzer] Be more careful with destructors of non-regions. ClosedPublic Authored by NoQ on Jul 26 2019, 2:04 PM.
Details Summary It turns out that we crash all over the place when we try to evaluate destructors over concrete-int-but-not-null locations. Add some defensive code.
Diff Detail
Event TimelineComment Actions Yes, it crashes! :-) I tried it because I did not believe it, but it does. Is there any real-world use-case for casting concrete integers to class instances? How did you find this crashing case?
Comment Actions
I think in original code this value was produced by doing pointer arithmetic over a null pointer. Which is kinda weird because we normally mis-model such arithmetic as resulting in a null pointer, so that to treat dereferences of such pointers as null dereferences (and abort the analysis immediately, never reaching the destructor). See also D37478. Also it seems that this bug has just been independently reported as https://bugs.llvm.org/show_bug.cgi?id=42816. This revision is now accepted and ready to land.Jul 29 2019, 8:35 PM Closed by commit rL369450: [analyzer] Fix a crash when destroying a non-region. (authored by NoQ). · Explain WhyAug 20 2019, 2:40 PM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 216256 cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp
cfe/trunk/test/Analysis/dtor.cpp
|