Fixed #5403 (Value flow: FP because post increment/decrement is not handled correctly)
This commit is contained in:
parent
bc9ad08831
commit
df0995edf5
|
@ -526,7 +526,7 @@ static void valueFlowAfterAssign(TokenList *tokenlist, ErrorLogger *errorLogger,
|
|||
}
|
||||
|
||||
// bailout increment/decrement for now..
|
||||
if (Token::Match(tok2->previous(), "++|-- %var%") || Token::Match(tok, "%var% ++|--")) {
|
||||
if (Token::Match(tok2->previous(), "++|-- %var%") || Token::Match(tok2, "%var% ++|--")) {
|
||||
if (settings->debugwarnings)
|
||||
bailout(tokenlist, errorLogger, tok2, "increment/decrement of " + tok2->str());
|
||||
break;
|
||||
|
|
|
@ -491,6 +491,13 @@ private:
|
|||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 4U, 9));
|
||||
|
||||
code = "void f() {\n"
|
||||
" static int x = 2;\n"
|
||||
" x++;\n"
|
||||
" return x;\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 4U, 2));
|
||||
|
||||
// function
|
||||
code = "void f() {\n"
|
||||
" char *x = 0;\n"
|
||||
|
|
Loading…
Reference in New Issue