[llvm-bugs] [Bug 25337] New: false positive: unitilization after switch
via llvm-bugs
llvm-bugs at lists.llvm.org
Wed Oct 28 09:26:09 PDT 2015
https://llvm.org/bugs/show_bug.cgi?id=25337
Bug ID: 25337
Summary: false positive: unitilization after switch
Product: clang
Version: 3.7
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: Static Analyzer
Assignee: kremenek at apple.com
Reporter: dushistov at gmail.com
CC: llvm-bugs at lists.llvm.org
Classification: Unclassified
For such code:
int f(unsigned val)
{
int res;
switch ((val & 1)) {
case 0: res = 1; break;
case 1: res = 2; break;
}
return res;
}
clang static analyser (3.7) return "Undefined or garbage value returned to
caller", but this is not true because of (val & 1) can produce only 0 or 1, so
all possible branches handled in switch, and res will contain not garbage.
--
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/20151028/94d0e28f/attachment.html>
More information about the llvm-bugs
mailing list