Fix FP in CheckCondition::multiCondition2
This commit is contained in:
parent
e5c6379d01
commit
ef4a7ba7f2
|
@ -491,7 +491,7 @@ void CheckCondition::multiCondition2()
|
|||
nonlocal |= (var && (var->isPointer() || var->isReference()));
|
||||
} else if (!nonlocal && cond->isName()) {
|
||||
// varid is 0. this is possibly a nonlocal variable..
|
||||
nonlocal = Token::Match(cond->astParent(), "%cop%|(");
|
||||
nonlocal = Token::Match(cond->astParent(), "%cop%|(|[");
|
||||
} else {
|
||||
tokens.push(cond->astOperand1());
|
||||
tokens.push(cond->astOperand2());
|
||||
|
|
|
@ -1532,6 +1532,15 @@ private:
|
|||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// undeclared array
|
||||
check("void f(int x) {\n"
|
||||
" if (a[x] > 0) {\n"
|
||||
" a[x] -= dt;\n"
|
||||
" if (a[x] < 0) {}\n"
|
||||
" }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #6313 - false positive: opposite conditions in nested if blocks when condition changed
|
||||
check("void Foo::Bar() {\n"
|
||||
" if(var){\n"
|
||||
|
|
Loading…
Reference in New Issue