[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-28 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rL311935: [analyzer] Fix crash in modeling arithmetic (authored by alexshap). Changed prior to commit: https://reviews.llvm.org/D37120?vs=112784&id=112967#toc Repository: rL LLVM https://reviews.llvm.

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-28 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ accepted this revision. NoQ added a comment. This revision is now accepted and ready to land. Thanks, LGTM! Repository: rL LLVM https://reviews.llvm.org/D37120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-28 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added a comment. updated the patch per suggestion by @NoQ Repository: rL LLVM https://reviews.llvm.org/D37120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-26 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap updated this revision to Diff 112784. alexshap added a comment. Return UnknownVal for non-comparison operations. Add FIXME (improve modeling of "pointers as integers"). Repository: rL LLVM https://reviews.llvm.org/D37120 Files: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp test/

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-26 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. Yeah, `LocAsInteger` is supported very poorly in most places. We can only get away with it because people rarely cast pointers to integers. Your reasoning about how `LocAsInteger` works poorly with eg. multiplication or bitwise operations (consider some sanitizer computing

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-25 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added inline comments. Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:363 case nonloc::LocAsIntegerKind: return evalBinOpLL(state, op, lhsL, rhs.castAs().getLoc(), @NoQ , @dcoughlin while we a

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-25 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap added inline comments. Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:371-373 +return makeSymExprValNN( +state, op, lhs.castAs(), +rhs.castAs(), resultTy); NoQ wrote: > For now this code would return

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-25 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. I guess we'd need more assertions to catch invalid symbols, will have a look. Comment at: lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp:371-373 +return makeSymExprValNN( +state, op, lhs.castAs(), +rhs.castAs(), re

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-25 Thread Alexander Kornienko via Phabricator via cfe-commits
alexfh added a comment. Thank you for the prompt fix! Repository: rL LLVM https://reviews.llvm.org/D37120 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D37120: [analyzer] Fix modeling arithmetic

2017-08-24 Thread Alexander Shaposhnikov via Phabricator via cfe-commits
alexshap created this revision. Herald added a subscriber: xazax.hun. This diff attempts to fix modeling of arithmetic expressions where pointers are treated as integers (i.e. via C-style / reinterpret casts). In particular, it resolves https://bugs.llvm.org/show_bug.cgi?id=34309 Test plan: make