[llvm-bugs] [Bug 40114] New: CSA issues false positive warning if `if()` is used.
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu Dec 20 06:00:09 PST 2018
https://bugs.llvm.org/show_bug.cgi?id=40114
Bug ID: 40114
Summary: CSA issues false positive warning if `if()` is used.
Product: clang
Version: 7.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: steveire at gmail.com
CC: dcoughlin at apple.com, llvm-bugs at lists.llvm.org
// Not decorated analyzer_noreturn
void someMethod()
{
}
struct A
{
int someApi();
};
int testAssert(A* a) {
return a->someApi();
}
int testAssert3(A* a) {
if (a)
; // do nothing
return a->someApi();
}
int testAssert5(A* a) {
if (a)
someMethod();
return a->someApi();
}
Neither of the following should be issued:
$ clang --analyze ../tmp/assert.cpp
../tmp/assert.cpp:20:12: warning: Called C++ object pointer is null
return a->someApi();
^~~~~~~~~~~~
../tmp/assert.cpp:26:12: warning: Called C++ object pointer is null
return a->someApi();
^~~~~~~~~~~~
2 warnings generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181220/b6b1d241/attachment.html>
More information about the llvm-bugs
mailing list