<html>
<head>
<base href="http://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - Static analyzer incorrectly models a synthesized assignment operator"
href="http://llvm.org/bugs/show_bug.cgi?id=16745">16745</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Static analyzer incorrectly models a synthesized assignment operator
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Static Analyzer
</td>
</tr>
<tr>
<th>Assignee</th>
<td>kremenek@apple.com
</td>
</tr>
<tr>
<th>Reporter</th>
<td>labath@google.com
</td>
</tr>
<tr>
<th>CC</th>
<td>klimek@google.com, llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ 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.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>