Uninitialized variables; Fixed FP for range for loop

This commit is contained in:
Daniel Marjamäki 2021-05-25 20:37:22 +02:00
parent 7d84b8f1bc
commit a4653a057a
2 changed files with 9 additions and 0 deletions

View File

@ -1528,6 +1528,8 @@ void CheckUninitVar::valueFlowUninit()
continue;
if (v->indirect > 1 || v->indirect < 0)
continue;
if (v->indirect == 0 && !isVariableUsage(tok, tok->valueType() && tok->valueType()->pointer > 0, NO_ALLOC))
continue;
bool uninitderef = false;
if (tok->variable()) {
bool unknown;

View File

@ -4639,6 +4639,13 @@ private:
"}");
ASSERT_EQUALS("", errout.str());
// range for..
valueFlowUninit("void f() {\n"
" X *item;\n"
" for (item: itemList) {}\n"
"}");
ASSERT_EQUALS("", errout.str());
// macro_for..
valueFlowUninit("int foo()\n"
"{\n"