[llvm-bugs] [Bug 28187] New: False positive error in scan-build: bit logic
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Jun 18 04:06:21 PDT 2016
https://llvm.org/bugs/show_bug.cgi?id=28187
Bug ID: 28187
Summary: False positive error in scan-build: bit logic
Product: clang
Version: 3.8
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: socketpair at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
#define F1 1
#define F2 2
int
main (int argc, char **argv)
{
const char *space;
int flags = argc;
if (flags & (F1 | F2))
space = "qwe";
if (flags & F1)
return *space;
return 0;
}
=========================
$ scan-build-3.8 gcc qwe.c
scan-build: Using '/usr/lib/llvm-3.8/bin/clang' for static analysis
qwe.c:17:12: warning: Dereference of undefined pointer value
return *space;
^~~~~~
1 warning generated.
scan-build: 1 bug found.
=========================
Using constants 0, 1, 2 and 3 instead of `argc` will not trigger that bug.
=========================
--
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/20160618/344bd116/attachment-0001.html>
More information about the llvm-bugs
mailing list