Fix 10582: ValueFlow; wrong known value (#3550)
This commit is contained in:
parent
1791457227
commit
a50596df72
@ -1748,7 +1748,7 @@ bool isReturnScope(const Token* const endToken, const Library* library, const To
|
|||||||
if (!functionScope && Token::simpleMatch(prev->link()->previous(), ") {") &&
|
if (!functionScope && Token::simpleMatch(prev->link()->previous(), ") {") &&
|
||||||
Token::simpleMatch(prev->link()->linkAt(-1)->previous(), "switch (") &&
|
Token::simpleMatch(prev->link()->linkAt(-1)->previous(), "switch (") &&
|
||||||
!Token::findsimplematch(prev->link(), "break", prev)) {
|
!Token::findsimplematch(prev->link(), "break", prev)) {
|
||||||
return true;
|
return isReturnScope(prev, library, unknownFunc, functionScope);
|
||||||
}
|
}
|
||||||
if (isEscaped(prev->link()->astTop(), functionScope, library))
|
if (isEscaped(prev->link()->astTop(), functionScope, library))
|
||||||
return true;
|
return true;
|
||||||
|
@ -3800,6 +3800,15 @@ private:
|
|||||||
" do {} while (i++ == 0);\n"
|
" do {} while (i++ == 0);\n"
|
||||||
"}\n");
|
"}\n");
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
// #10582
|
||||||
|
check("static void fun(message_t *message) {\n"
|
||||||
|
" if (message->length >= 1) {\n"
|
||||||
|
" switch (data[0]) {}\n"
|
||||||
|
" }\n"
|
||||||
|
" uint8_t d0 = message->length > 0 ? data[0] : 0xff;\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
void alwaysTrueSymbolic()
|
void alwaysTrueSymbolic()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user