[LLVMbugs] [Bug 21789] New: False positive - std::vector<T>::size() won't change in two subsequent invocations

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Dec 9 07:04:01 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21789

            Bug ID: 21789
           Summary: False positive - std::vector<T>::size() won't change
                    in two subsequent invocations
           Product: clang
           Version: 3.5
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: frerich.raabe+llvmbug at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13443
  --> http://llvm.org/bugs/attachment.cgi?id=13443&action=edit
Tiny testcase to trigger the issue

Using 'Debian clang version 3.5.0-1~exp1 (trunk) (based on LLVM 3.5.0)' on the
attached program will emit a 'running scan-build on the following program will
emit a warning saying

foo.cpp:13:16: warning: Dereference of undefined pointer value
        (void)(*x + 1);

It appears this is because the analyzer doesn't see that two subsequent
invocations of std::vector<T>::size() will yield the same value, i.e. if the
second if() was hit then the first one must've been hit as well. I suspect this
could be considered a defect since the compiler most certainly saw the
implementation of size()?

-- 
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/20141209/ae6b8a5c/attachment.html>


More information about the llvm-bugs mailing list