Open Quuxplusone opened 7 years ago
Bugzilla Link | PR30936 |
Status | NEW |
Importance | P normal |
Reported by | Alexander Kornienko (alexfh@google.com) |
Reported on | 2016-11-07 15:45:06 -0800 |
Last modified on | 2017-10-04 06:40:10 -0700 |
Version | trunk |
Hardware | PC All |
CC | llvm-bugs@lists.llvm.org, sbenza@google.com, xazax.hun@gmail.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Thanks for the reproducer!
I looked into this a bit using Alexander's reproducer and the gtest sources on GitHub.
There are two separate confounders to reasoning about AssertionResult.
(1) As Alexander notes, the implementation of the copy constructor is not exposed in the header so the analyzer doesn't model it. Since the class is not trivial the analyzer doesn't treat it as C-struct-like copy.
(2) The boolean constructor is into a temporary and since there are cleanups the analyzer doesn't do its trick to try to construct it directly into the variable storage instead. Since the the constructor is on a temporary and has a destructor, the analyzer skips inlining the constructor -- this is to avoid inconsistency because the analyzer's support for temporary destructors is not yet turned on by default.
One possibility for addressing this is to explicitly model the non-inlined parts of the API in an API-specific checker. I have a hacked up prototype of this that seems to work quite well.
A proposed patch addressing the false positive is up for review at https://reviews.llvm.org/D27773
The linked phabricator review is closed. Can this issue be closed as well?
Never mind, the patch is for the false positive for gtest. The underlying issue is still not solved.