NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

Thanks! This looks great now.



================
Comment at: lib/StaticAnalyzer/Checkers/CStringChecker.cpp:1055
+    std::tie(StateNullChar, StateNonNullChar) =
+        assumeZero(C, State, CharVal, Ctx.UnsignedCharTy);
+
----------------
MTC wrote:
> NoQ wrote:
> > I think this should use `IntTy` here. Because that's the type of the 
> > `memset`'s argument, and that's what `assumeZero()` expects.
> I confirmed again that `memset()` will convert the value to `unsigned char` 
> first, see http://en.cppreference.com/w/c/string/byte/memset. 
> 
> In the next update, I will `evalCast(value, UnsignedCharTy, IntTy)` first, 
> therefore, I will continue to use `UnsignedCharTy`.
Aha, yup, it does convert to `unsigned char`, but `assumeZero()` doesn't. The 
new code looks correct.


Repository:
  rC Clang

https://reviews.llvm.org/D44934



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to