Fixed #1503 (False positive for uninitialized variable)
This commit is contained in:
parent
89c57c72c5
commit
15d67a2369
|
@ -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++);
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in New Issue