Fix 10619: Valueflow: Library function in subfunction does not propagate all values (#4209)
This commit is contained in:
parent
bd63534a1c
commit
d4fb5652c0
|
@ -6820,6 +6820,8 @@ bool productParams(const std::unordered_map<Key, std::list<ValueFlow::Value>>& v
|
||||||
for (auto arg:args) {
|
for (auto arg:args) {
|
||||||
if (value.path != 0) {
|
if (value.path != 0) {
|
||||||
for (const auto& q:arg) {
|
for (const auto& q:arg) {
|
||||||
|
if (q.first == p.first)
|
||||||
|
continue;
|
||||||
if (q.second.path == 0)
|
if (q.second.path == 0)
|
||||||
continue;
|
continue;
|
||||||
if (q.second.path != value.path)
|
if (q.second.path != value.path)
|
||||||
|
|
|
@ -4398,6 +4398,17 @@ private:
|
||||||
"}\n";
|
"}\n";
|
||||||
ASSERT_EQUALS(true, testValueOfX(code, 7U, 0));
|
ASSERT_EQUALS(true, testValueOfX(code, 7U, 0));
|
||||||
ASSERT_EQUALS(false, testValueOfXKnown(code, 7U, 0));
|
ASSERT_EQUALS(false, testValueOfXKnown(code, 7U, 0));
|
||||||
|
|
||||||
|
code = "int f(int i) {\n"
|
||||||
|
" int x = abs(i);\n"
|
||||||
|
" return x;\n"
|
||||||
|
"}\n"
|
||||||
|
"void g() {\n"
|
||||||
|
" f(1);\n"
|
||||||
|
" f(0);\n"
|
||||||
|
"}\n";
|
||||||
|
ASSERT_EQUALS(true, testValueOfX(code, 3U, 1));
|
||||||
|
ASSERT_EQUALS(true, testValueOfX(code, 3U, 0));
|
||||||
}
|
}
|
||||||
void valueFlowFunctionReturn() {
|
void valueFlowFunctionReturn() {
|
||||||
const char *code;
|
const char *code;
|
||||||
|
|
Loading…
Reference in New Issue