<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 --- - an unneeded -Warray-bounds warning?"
href="http://llvm.org/bugs/show_bug.cgi?id=15547">15547</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>an unneeded -Warray-bounds warning?
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>3.2
</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>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>slayoo@igf.fuw.edu.pl
</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>$ cat test.cpp
#include <iostream>
int main()
{
int tmp[1] = { 123 };
int step = 1;
int &a = (step == 1) ? tmp[0] : tmp[1];
std::cerr << "a=" << a << std::endl;
}
$ clang++ test.cpp
test.cpp:6:35: warning: array index 1 is past the end of the array (which
contains 1 element) [-Warray-bounds]
int &a = (step == 1) ? tmp[0] : tmp[1];
^ ~
test.cpp:4:3: note: array 'tmp' declared here
int tmp[1] = { 123 };
^
1 warning generated.
$ ./a.out
a=123
$ clang++ --version
Debian clang version 3.2-1~exp7 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
HTH,
Sylwester</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>