forked from OSchip/llvm-project
Fix bogus -Warray-bounds warning involving 'array[true]' reported in PR 9296.
llvm-svn: 126341
This commit is contained in:
parent
7b0f796c55
commit
e4b316c15c
|
@ -3123,7 +3123,7 @@ void Sema::CheckArrayAccess(const clang::ArraySubscriptExpr *E) {
|
|||
if (!IndexExpr->isIntegerConstantExpr(index, Context))
|
||||
return;
|
||||
|
||||
if (!index.isNegative()) {
|
||||
if (index.isUnsigned() || !index.isNegative()) {
|
||||
llvm::APInt size = ArrayTy->getSize();
|
||||
if (!size.isStrictlyPositive())
|
||||
return;
|
||||
|
|
|
@ -115,3 +115,8 @@ void test_pr9284() {
|
|||
pr9284b<false>(); // expected-note{{in instantiation of function template specialization 'pr9284b<false>' requested here}}
|
||||
}
|
||||
|
||||
int test_pr9296() {
|
||||
int array[2];
|
||||
return array[true]; // no-warning
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue