[LLVMbugs] [Bug 16745] New: Static analyzer incorrectly models a synthesized assignment operator

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jul 30 03:17:27 PDT 2013


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

            Bug ID: 16745
           Summary: Static analyzer incorrectly models a synthesized
                    assignment operator
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Static Analyzer
          Assignee: kremenek at apple.com
          Reporter: labath at google.com
                CC: klimek at google.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

$ cat small.cc
struct A {
  A& operator=(A&);
};

struct B {
  int a;
  A b[1];
};

void fn1() {
  B v, u;
  u = v;
}

$ clang -std=c++11 --analyze small.cc -Xanalyzer -analyzer-output=text
small.cc:5:8: warning: Array subscript is undefined
struct B {
       ^
small.cc:12:3: note: Calling implicit copy assignment operator for 'B'
  u = v;
  ^
small.cc:5:8: note: Loop condition is true. Entering loop body
struct B {
       ^
small.cc:5:8: note: Uninitialized value stored to '__i0'
small.cc:5:8: note: Array subscript is undefined
1 warning generated.


I haven't looked into how the synthesized function looks like, but obviously it
uses a loop to copy the b sub-array and somehow the loop variable ends up
undefined.

-- 
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/20130730/f3d3a4c3/attachment.html>


More information about the llvm-bugs mailing list