[llvm-bugs] [Bug 39032] New: Static Analyzer false positive: initialized value is believed to be uninitialized
via llvm-bugs
llvm-bugs at lists.llvm.org
Fri Sep 21 00:15:16 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=39032
Bug ID: 39032
Summary: Static Analyzer false positive: initialized value is
believed to be uninitialized
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Static Analyzer
Assignee: dcoughlin at apple.com
Reporter: bevin.hansson at ericsson.com
CC: llvm-bugs at lists.llvm.org
Created attachment 20903
--> https://bugs.llvm.org/attachment.cgi?id=20903&action=edit
reproducer
In the attached example, Static Analyzer claims that a value which is
definitely initialized is not. Determining _what_ it is initialized to might be
a more difficult exercise, but it certainly is not uninitialized.
clang -cc1 -analyze -analyzer-checker=core sa.c
sa.c:10:3: warning: 1st function call argument is an uninitialized value
fn(ptr[1]);
^~~~~~~~~~
If we try to access ptr[0] instead, the warning goes away.
I suspect this might be due to deficiencies in RegionStore. SA knows that ptr
points to str, but it cannot seem to locate the binding to str through an
ElementRegion with an offset of 1.
I'd fix this myself, but I don't know if this is a problem with how RegionStore
looks up the bindings, either in getBindingForElement or
getBindingForFieldOrElementCommon, or if it's a problem with how it registers
the binding of str. Or something completely different altogether.
--
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/20180921/7181e91e/attachment-0001.html>
More information about the llvm-bugs
mailing list