Fix false positive nullPointer messages within sqlite3 after goto by adding a suitable bailout inside valueFlowAfterAssign()
This commit is contained in:
parent
11856b51aa
commit
b74e997435
|
@ -612,7 +612,7 @@ static void valueFlowAfterAssign(TokenList *tokenlist, ErrorLogger *errorLogger,
|
|||
tok2 = tok2->linkAt(2);
|
||||
}
|
||||
|
||||
else if (indentlevel <= 0 && Token::Match(tok2, "break|continue")) {
|
||||
else if (indentlevel <= 0 && Token::Match(tok2, "break|continue|goto")) {
|
||||
if (settings->debugwarnings)
|
||||
bailout(tokenlist, errorLogger, tok2, "variable " + var->nameToken()->str() + ". noreturn conditional scope.");
|
||||
break;
|
||||
|
|
|
@ -623,6 +623,17 @@ private:
|
|||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 7U, 0));
|
||||
|
||||
code = "void f () {\n"
|
||||
" ST * x = g_pST;\n"
|
||||
" if (x->y == 0) {\n"
|
||||
" x = NULL;\n"
|
||||
" goto label;\n"
|
||||
" }\n"
|
||||
" a = x->y;\n"
|
||||
"label:\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 7U, 0));
|
||||
|
||||
// multivariables
|
||||
code = "void f(int a) {\n"
|
||||
" int x = a;\n"
|
||||
|
|
Loading…
Reference in New Issue