[PATCH] D23014: [analyzer] Model base to derived casts more precisely.

Artem Dergachev via cfe-commits cfe-commits at lists.llvm.org
Tue Aug 2 07:01:45 PDT 2016


NoQ added inline comments.

================
Comment at: lib/StaticAnalyzer/Core/ExprEngineC.cpp:423
@@ +422,3 @@
+
+        if (!val.isZeroConstant()) {
+          val = getStoreManager().evalDynamicCast(val, T, Failed);
----------------
xazax.hun wrote:
> NoQ wrote:
> > I guess if `val` is a //non-zero// constant, it wouldn't make much difference.
> I might be wrong, but isn't the only valid constant value for a pointer the zero constant?
Even if forbidden by the Standard in well-formed programs, we'd have to expect it here - after all, it's great if we analyze a program that has a bug :)

We also have this `FixedAddressChecker` thing, so even in our simplified model, there actually do exist non-zero constant pointers. That said, there's some bug i stepped into in explain-svals.cpp, which produces more zero constant pointers that one would expect, didn't have time to investigate yet...


https://reviews.llvm.org/D23014





More information about the cfe-commits mailing list