[LLVMbugs] [Bug 15547] New: an unneeded -Warray-bounds warning?
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Mar 19 13:19:13 PDT 2013
http://llvm.org/bugs/show_bug.cgi?id=15547
Bug ID: 15547
Summary: an unneeded -Warray-bounds warning?
Product: clang
Version: 3.2
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: -New Bugs
Assignee: unassignedclangbugs at nondot.org
Reporter: slayoo at igf.fuw.edu.pl
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
$ 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
--
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/20130319/fc5d475a/attachment.html>
More information about the llvm-bugs
mailing list