Currently clang static analyzer does warn on:
int x; x+=1; x-=1; x=x+1; x=x-1;
But does warn on:
int x; x++; x--; --x; ++x;
This differential should fix that.
Fixes https://bugs.llvm.org/show_bug.cgi?id=35419
Paths
| Differential D40463
[analyzer] Fix false negative on post-increment of uninitialized variable. ClosedPublic Authored by lebedev.ri on Nov 26 2017, 1:18 AM.
Details Summary Currently clang static analyzer does warn on: int x; x+=1; x-=1; x=x+1; x=x-1; But does warn on: int x; x++; x--; --x; ++x; This differential should fix that.
Diff Detail
Event TimelineHerald added subscribers: a.sidorin, szepet, xazax.hun. · View Herald TranscriptNov 26 2017, 1:18 AM
xazax.hun added inline comments.
jordan_rose edited reviewers, added: dergachev.a; removed: krememek, jordan_rose.Nov 27 2017, 10:16 AM Comment Actions Thanks for tackling this! There is one major comment inline (you are generating an extra node that you shouldn't, which is causing the analyzer to explore code it shouldn't) and a suggestion for simpler diagnostic text.
lebedev.ri marked 5 inline comments as done. Comment Actions@dcoughlin thank you for the review! A few notes of my own below.
lebedev.ri marked 8 inline comments as done. Comment ActionsAddress @dcoughlin's review notes.
Comment Actions Thanks, this looks good to me! Do you have commit access or do you need someone to commit it for you?
This revision is now accepted and ready to land.Nov 29 2017, 3:03 PM Comment Actions
Awesome, thank you!
I do have commit access. Closed by commit rL319411: [analyzer] Fix false negative on post-increment of uninitialized variable. (authored by lebedevri). · Explain WhyNov 30 2017, 1:19 AM This revision was automatically updated to reflect the committed changes.
Revision Contents
Diff 124882 cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineC.cpp
cfe/trunk/test/Analysis/malloc-plist.c
cfe/trunk/test/Analysis/objc-for.m
cfe/trunk/test/Analysis/uninit-const.c
|