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: dcough...@apple.com
Reporter: lebedev...@gmail.com
CC: llvm-bugs@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs