Fix #1296 (false positive: index out of bounds)
http://sourceforge.net/apps/trac/cppcheck/ticket/1296
This commit is contained in:
parent
863a42797f
commit
b83d257852
|
@ -4187,7 +4187,7 @@ bool Tokenizer::simplifyCalculations()
|
|||
if (Token::Match(tok->previous(), "- %num% - %num%"))
|
||||
tok->str(MathLib::calculate(tok->str(), tok->tokAt(2)->str(), '+'));
|
||||
else if (Token::Match(tok->previous(), "- %num% + %num%"))
|
||||
tok->str(MathLib::calculate(tok->tokAt(2)->str(), tok->str(), '-'));
|
||||
tok->str(MathLib::calculate(tok->str(), tok->tokAt(2)->str(), '-'));
|
||||
else
|
||||
tok->str(MathLib::calculate(tok->str(), tok->tokAt(2)->str(), *(tok->strAt(1))));
|
||||
|
||||
|
|
|
@ -1940,6 +1940,7 @@ private:
|
|||
ASSERT_EQUALS("x = 900 ;", tok("x = 1500000 / ((145000 - 55000) * 1000 / 54000);"));
|
||||
ASSERT_EQUALS("int a [ 8 ] ;", tok("int a[5+6/2];"));
|
||||
ASSERT_EQUALS("int a [ 4 ] ;", tok("int a[(10)-1-5];"));
|
||||
ASSERT_EQUALS("int a [ i - 9 ] ;", tok("int a[i - 10 + 1];"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue