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