[LLVMbugs] [Bug 9828] New: False positive for null function pointer call following assert()
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Mon May 2 08:40:19 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=9828
Summary: False positive for null function pointer call
following assert()
Product: clang
Version: unspecified
Platform: Macintosh
OS/Version: MacOS X
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
AssignedTo: kremenek at apple.com
ReportedBy: hyrum at hyrumwright.org
CC: llvmbugs at cs.uiuc.edu
Created an attachment (id=6521)
--> (http://llvm.org/bugs/attachment.cgi?id=6521)
Test case.
I'm using the analyzer on the following test case:
[[[
#include <stdlib.h>
typedef int (*foo_editor_cb_complete_t)(void *baton);
int
foo_editor_complete(foo_editor_cb_complete_t func)
{
assert(func != NULL);
return func(NULL);
}
]]]
The results are:
[[[
cca-bug1.c:9:10: warning: Called function pointer is null (null dereference)
return func(NULL);
^
1 warning generated.
scan-build: 1 bugs found.
]]]
I believe the above to be a false positive. The assert() on line 8 should
eliminate any concerns that the called function pointer is NULL. However, the
analyzer misses this fact and generates the bug all the same.
I'm using the checker-256 release on Mac OS X.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list