parent
6316479782
commit
0d02c0a1a7
|
@ -2412,7 +2412,7 @@ bool isVariableChangedByFunctionCall(const Token *tok, int indirect, const Setti
|
|||
// If const is applied to the pointer, then the value can still be modified
|
||||
if (Token::simpleMatch(arg->typeEndToken(), "* const"))
|
||||
return true;
|
||||
if (!arg->isPointer() && (!arg->valueType() || arg->valueType()->type == ValueType::UNKNOWN_TYPE))
|
||||
if (arg->isArray() || (!arg->isPointer() && (!arg->valueType() || arg->valueType()->type == ValueType::UNKNOWN_TYPE)))
|
||||
return true;
|
||||
}
|
||||
if (!arg->isConst() && arg->isReference())
|
||||
|
|
|
@ -5416,6 +5416,19 @@ private:
|
|||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #11624
|
||||
valueFlowUninit("const int N = 2;\n"
|
||||
"void g(int a[N]) {\n"
|
||||
" for (int i = 0; i < N; ++i)\n"
|
||||
" a[i] = 1;\n"
|
||||
"}\n"
|
||||
"void f() {\n"
|
||||
" int a[N];\n"
|
||||
" g(a);\n"
|
||||
" if (a[0]) {}\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void valueFlowUninitBreak() { // Do not show duplicate warnings about the same uninitialized value
|
||||
|
|
Loading…
Reference in New Issue