[llvm-bugs] [Bug 35418] New: Analyzer: false-positives about unintialized value
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat Nov 25 05:45:18 PST 2017
https://bugs.llvm.org/show_bug.cgi?id=35418
Bug ID: 35418
Summary: Analyzer: false-positives about unintialized value
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: lebedev.ri at gmail.com
CC: llvm-bugs at lists.llvm.org
https://godbolt.org/g/5ipje4
Hand-reduced code:
#include <cassert>
void decode(unsigned width) {
assert(width > 0);
int base;
bool inited = false;
int i = 0;
if (i % width == 0) {
base = 512;
inited = true;
}
// assert(inited); // <- if i uncomment this, the warning is gone.
base+=1;
if (base >> 10)
assert(false);
}
I think it should be obvious from the code that `assert(inited);` will always
be reached with `inited == true`.
Also, problem 2: if i replace `base+=1;` with `base++;`, it would no longer
warn there.
For the reference, this is the full original code:
https://github.com/darktable-org/rawspeed/blob/ec958b8550d526ae8904691e96fb34959f69835b/src/librawspeed/decompressors/CrwDecompressor.cpp#L275
--
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/20171125/5b308781/attachment-0001.html>
More information about the llvm-bugs
mailing list