<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 --- - False positive: reinterpret_cast<*> garbage or undefined assignment"
href="http://llvm.org/bugs/show_bug.cgi?id=19338">19338</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>False positive: reinterpret_cast<*> garbage or undefined assignment
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>Macintosh
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</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>spam@drgonzo.nl
</td>
</tr>
<tr>
<th>CC</th>
<td>llvmbugs@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>Analyzing the following program using the pre-built 'checker-276' available for
Mac OS X causes a false positive (Mac OS X 10.6.8 on a MacBook 1,1):
#include <arpa/inet.h>
#include <stdint.h>
int main() {
uint32_t payload[2];
payload[0] = htonl(0x01);
payload[1] = htonl(0x01);
uint8_t* bytes = new uint8_t[9];
bytes[0] = 0x11;
uint8_t* payloadBytes = reinterpret_cast<uint8_t*>(payload);
for (size_t i = 0; i < 8; i++) {
bytes[1 + i] = payloadBytes[i];
}
return 0;
}
The analyzer warning is:
test.cpp:14:16: warning: Assigned value is garbage or undefined
bytes[1 + i] = payloadBytes[i];
^ ~~~~~~~~~~~~~~~</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>