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

Reply via email to