Fixed #1503 (False positive for uninitialized variable)

This commit is contained in:
Daniel Marjamäki 2010-03-16 19:09:37 +01:00
parent 89c57c72c5
commit 15d67a2369
2 changed files with 9 additions and 1 deletions

View File

@ -1650,7 +1650,7 @@ private:
CheckUninitVar *c = dynamic_cast<CheckUninitVar *>(*it);
if (c && c->varId == varid)
{
if (c->alloc)
if (c->alloc || c->array)
{
delete c;
checks.erase(it++);

View File

@ -1552,6 +1552,14 @@ private:
// arrays..
void uninitvar_arrays()
{
checkUninitVar("int f()\n"
"{\n"
" char a[10];\n"
" *a = '\\0';\n"
" int i = strlen(a);\n"
"}\n");
ASSERT_EQUALS("", errout.str());
checkUninitVar("void f()\n"
"{\n"
" char a[10], b[10];\n"