Uninitialized variables: fixed false positives when using pointer aliasing
This commit is contained in:
parent
94d5e32aa1
commit
b8b6b0ec32
|
@ -1859,6 +1859,11 @@ private:
|
|||
use_pointer(foundError, checks, &tok);
|
||||
return &tok;
|
||||
}
|
||||
|
||||
if (Token::simpleMatch(tok.previous(), "&"))
|
||||
{
|
||||
ExecutionPath::bailOutVar(checks, tok.varId());
|
||||
}
|
||||
}
|
||||
return &tok;
|
||||
}
|
||||
|
|
|
@ -1150,6 +1150,15 @@ private:
|
|||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("void a()\n"
|
||||
"{\n"
|
||||
" int x;\n"
|
||||
" int *y = &x;\n"
|
||||
" *y = 0;\n"
|
||||
" x++;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar("int a()\n"
|
||||
"{\n"
|
||||
" int ret;\n"
|
||||
|
|
Loading…
Reference in New Issue