parent
f054feba85
commit
a52d2a23a0
|
@ -7258,7 +7258,8 @@ struct MultiValueFlowAnalyzer : ValueFlowAnalyzer {
|
|||
}
|
||||
|
||||
bool stopOnCondition(const Token* /*condTok*/) const override {
|
||||
return isConditional();
|
||||
// TODO fix false negatives
|
||||
return true; // isConditional();
|
||||
}
|
||||
|
||||
bool updateScope(const Token* endBlock, bool /*modified*/) const override {
|
||||
|
|
|
@ -2386,11 +2386,12 @@ private:
|
|||
"void g(const std::vector<int>& w) {\n"
|
||||
" f(-1, w);\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("test.cpp:5:warning:Array index -1 is out of bounds.\n"
|
||||
"test.cpp:8:note:Calling function 'f', 1st argument '-1' value is -1\n"
|
||||
"test.cpp:3:note:Assuming condition is false\n"
|
||||
"test.cpp:5:note:Negative array index\n",
|
||||
errout.str());
|
||||
TODO_ASSERT_EQUALS("test.cpp:5:warning:Array index -1 is out of bounds.\n"
|
||||
"test.cpp:8:note:Calling function 'f', 1st argument '-1' value is -1\n"
|
||||
"test.cpp:3:note:Assuming condition is false\n"
|
||||
"test.cpp:5:note:Negative array index\n",
|
||||
"",
|
||||
errout.str());
|
||||
|
||||
settings = oldSettings;
|
||||
}
|
||||
|
|
|
@ -6490,7 +6490,7 @@ private:
|
|||
" bool copied_all = true;\n"
|
||||
" g(&copied_all, 5, 6, &bytesCopied);\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:2]: (warning) Uninitialized variable: *buflen\n", errout.str());
|
||||
TODO_ASSERT_EQUALS("[test.cpp:7] -> [test.cpp:2]: (warning) Uninitialized variable: *buflen\n", "", errout.str());
|
||||
|
||||
// # 9953
|
||||
valueFlowUninit("uint32_t f(uint8_t *mem) {\n"
|
||||
|
|
|
@ -4517,7 +4517,7 @@ private:
|
|||
"void f(Object *obj) {\n"
|
||||
" if (valid(obj, K0)) {}\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 7U, 0));
|
||||
TODO_ASSERT_EQUALS(true, false, testValueOfX(code, 7U, 0));
|
||||
ASSERT_EQUALS(false, testValueOfXKnown(code, 7U, 0));
|
||||
|
||||
code = "int f(int i) {\n"
|
||||
|
@ -4530,7 +4530,21 @@ private:
|
|||
"}\n";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 3U, 1));
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 3U, 0));
|
||||
|
||||
code = "void foo(int* p, int* x) {\n"
|
||||
" bool b1 = (p != NULL);\n"
|
||||
" bool b2 = b1 && (x != NULL);\n"
|
||||
" if (b2) {\n"
|
||||
" *x = 3;\n"
|
||||
" }\n"
|
||||
"}\n"
|
||||
"\n"
|
||||
"void bar() {\n"
|
||||
" foo(NULL, NULL);\n"
|
||||
"}\n";
|
||||
ASSERT_EQUALS(false, testValueOfX(code, 5U, 0));
|
||||
}
|
||||
|
||||
void valueFlowFunctionReturn() {
|
||||
const char *code;
|
||||
|
||||
|
|
Loading…
Reference in New Issue