Fixed #4519 (false positive: (error) Uninitialized variable: eax (inline assembly usage))
This commit is contained in:
parent
c192e4d669
commit
28e38a9e56
|
@ -1456,6 +1456,9 @@ bool CheckUninitVar::checkLoopBody(const Token *tok, const Variable& var, const
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (Token::Match(tok, "asm ( %str% ) ;"))
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!suppressErrors && usetok) {
|
||||
|
|
|
@ -2693,6 +2693,14 @@ private:
|
|||
|
||||
void uninitvar2_while() {
|
||||
// for, while
|
||||
checkUninitVar2("void f() {\n"
|
||||
" int x;\n"
|
||||
" while (a) {\n"
|
||||
" x = x + 1;\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
TODO_ASSERT_EQUALS("error", "", errout.str());
|
||||
|
||||
checkUninitVar2("void f() {\n"
|
||||
" int x;\n"
|
||||
" while (a) {\n"
|
||||
|
@ -2768,6 +2776,15 @@ private:
|
|||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
checkUninitVar2("void f(){\n" // #4519 - fp: inline assembler in loop
|
||||
" int x;\n"
|
||||
" for (int i = 0; i < 10; i++) {\n"
|
||||
" asm(\"foo\");\n"
|
||||
" if (x & 0xf1) { }\n"
|
||||
" }\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void uninitvar2_4494() {
|
||||
|
|
Loading…
Reference in New Issue