[PATCH] D118050: [analyzer] Different address spaces cannot overlap

Vince Bridgers via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 24 01:09:27 PST 2022


vabridgers added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:726-727
+      LhsLoc.getType(Ctx).isNull() ? 0 : Ctx.getTypeSize(LhsLoc.getType(Ctx));
+  if (RhsBitwidth && LhsBitwidth &&
+      (LhsLoc.getSubKind() == RhsLoc.getSubKind())) {
+    assert(RhsBitwidth == LhsBitwidth &&
----------------
steakhal wrote:
> You should probably ignore references.
> Ah, but we already lost that information. Well, that's bad.
> Anyway. You probably don't need to check the subkinds. Do you?
There was a case I hit in my testing where the subkinds were different and a crash occurred. I cannot recall the details at the moment, but it made sense at the time to also check subkkinds. I'll check this again so I can describe the rationale for this.


================
Comment at: clang/lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:745
+  // See LIT case clang/test/Analysis/cstring-checker-addressspace.c
+  assertEqualBitWidths(state, rhs, lhs);
+
----------------
steakhal wrote:
> You don't use the return value of this call.
> Can we have a `void` return type instead?
Yes, will do.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118050/new/

https://reviews.llvm.org/D118050



More information about the cfe-commits mailing list