Fixed #1153 (False positive: uninitialized data for reinterpret_cast)

This commit is contained in:
Daniel Marjamäki 2009-12-27 09:27:05 +01:00
parent afad0205c4
commit fbfe5a4bd1
2 changed files with 8 additions and 1 deletions

View File

@ -1415,7 +1415,7 @@ private:
CheckUninitVar *c = dynamic_cast<CheckUninitVar *>(*it);
if (c && c->varId == varid)
{
if (mode == 0 && c->array)
if (mode == 0 && (c->array || (c->pointer && c->alloc)))
continue;
if (mode == 2 && !c->pointer)
continue;

View File

@ -1080,6 +1080,13 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void foo()\n"
"{\n"
" char *buf = malloc(100);\n"
" struct ABC *abc = buf;\n"
"}\n");
ASSERT_EQUALS("", errout.str());
// goto..
checkUninitVar("void foo(int x)\n"
"{\n"