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: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to