[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-22 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC323115: [analyzer] Model and check unrepresentable left shifts (authored by xazax, committed by ). Changed prior to commit: https://reviews.llvm.org/D41816?vs=129905&id=130868#toc Repository: rC Clan

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-21 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin accepted this revision. dcoughlin added a comment. Looks good to me, thanks! https://reviews.llvm.org/D41816 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-15 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added inline comments. Comment at: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp:150 +SB.getKnownValue(state, C.getSVal(B->getRHS())); +if ((unsigned) RHS->getZExtValue() > LHS->countLeadingZeros()) { + OS << "The result of the left shif

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-15 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 129905. rnkovacs marked an inline comment as done. https://reviews.llvm.org/D41816 Files: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp lib/StaticAnalyzer/Core/BasicValueFactory.cpp test/Analysis/bitwise-ops.c Index: test/Analysis/bitwise-ops.c

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-12 Thread Devin Coughlin via Phabricator via cfe-commits
dcoughlin added a comment. The diagnostic text looks to me, but I do have a comment about the nested 'if' inline. Comment at: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp:150 +SB.getKnownValue(state, C.getSVal(B->getRHS())); +if ((unsigned) RHS->getZE

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-11 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 129448. rnkovacs added a comment. I extended the warning message to include more information. What do you think? https://reviews.llvm.org/D41816 Files: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp lib/StaticAnalyzer/Core/BasicValueFactory.cpp t

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-10 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. Looks great. @dcoughlin: would you approve the warning message text? Maybe actually we could print out the exact numbers that cause the bit shift to overflow, since we do have them when we check.

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-09 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs added a comment. In https://reviews.llvm.org/D41816#970845, @xazax.hun wrote: > Overall looks good to me, one comment inline. I think it is good to have > these checks to prevent the analyzer executing undefined behavior. Maybe this > would make it more feasible to run the analyzer wit

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-09 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs updated this revision to Diff 129071. rnkovacs marked an inline comment as done. https://reviews.llvm.org/D41816 Files: lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp lib/StaticAnalyzer/Core/BasicValueFactory.cpp test/Analysis/bitwise-ops.c Index: test/Analysis/bitwise-ops.c

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-09 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment. Overall looks good to me, one comment inline. I think it is good to have these checks to prevent the analyzer executing undefined behavior. Maybe this would make it more feasible to run the analyzer with ubsan :) In the future, it would be great to also look for these

[PATCH] D41816: [analyzer] Model and check unrepresentable left shifts

2018-01-08 Thread Reka Kovacs via Phabricator via cfe-commits
rnkovacs created this revision. rnkovacs added reviewers: NoQ, dcoughlin, xazax.hun. Herald added subscribers: a.sidorin, szepet, baloghadamsoftware, whisperity. Left shifting a signed positive value is undefined if the result is not representable in the unsigned version of the return type. The