[cfe-dev] Start of some easy task in Clang Static Analyzer

Artem Dergachev via cfe-dev cfe-dev at lists.llvm.org
Thu May 26 05:50:57 PDT 2016


Hmm. Thanks for asking, your enthusiasm inspires me! :)

Unless anybody has a better idea, maybe, if you like, you could have a 
quick look at the FIXME in test/Analysis/explain-svals.cpp ? Adding 1 to 
a pointer constrained to 0 results in value 0 rather than in 1, long 
story short:

   int *x = ...;
   if (!x)
     x + 1; // 0 (Loc), should be 1 (Loc)

Which means there's some problem in modeling pointer arithmetic in 
SValBuilder, there must be some place in which the region's offset was 
omitted during calculations; i'm not sure the fix is easy, but i don't 
see any obvious problems that would cause that, so it's probably an 
omission.



More information about the cfe-dev mailing list