Fix 10916: FP: uninitvar (#3949)
This commit is contained in:
parent
63d96e49fc
commit
21b8c36eb1
|
@ -7076,7 +7076,7 @@ static void valueFlowUninit(TokenList* tokenlist, SymbolDatabase* /*symbolDataba
|
||||||
uninitValue.valueType = ValueFlow::Value::ValueType::UNINIT;
|
uninitValue.valueType = ValueFlow::Value::ValueType::UNINIT;
|
||||||
uninitValue.tokvalue = tok;
|
uninitValue.tokvalue = tok;
|
||||||
if (var->isArray())
|
if (var->isArray())
|
||||||
uninitValue.indirect = 1;
|
uninitValue.indirect = var->dimensions().size();
|
||||||
|
|
||||||
bool partial = false;
|
bool partial = false;
|
||||||
|
|
||||||
|
|
|
@ -6139,6 +6139,19 @@ private:
|
||||||
" (*fp[0])();\n"
|
" (*fp[0])();\n"
|
||||||
"}");
|
"}");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
valueFlowUninit("static void Foo(double* p) {\n"
|
||||||
|
" p[0] = 0;\n"
|
||||||
|
" p[1] = 0;\n"
|
||||||
|
" p[2] = 0;\n"
|
||||||
|
" p[3] = 0;\n"
|
||||||
|
"}\n"
|
||||||
|
"double f() {\n"
|
||||||
|
" double L[2][2];\n"
|
||||||
|
" Foo(*L);\n"
|
||||||
|
" return L[0][0];\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void uninitvar_memberaccess() {
|
void uninitvar_memberaccess() {
|
||||||
|
|
Loading…
Reference in New Issue