Fix 10677: crash during valueFlowInferCondition (#3687)
This commit is contained in:
parent
4a3a287248
commit
fe7595cd9d
|
@ -4450,6 +4450,8 @@ static std::vector<const Token*> getConditions(const Token* tok, const char* op)
|
|||
return false;
|
||||
if (tok2->hasKnownIntValue())
|
||||
return false;
|
||||
if (Token::Match(tok2, "%var%") && !astIsBool(tok2))
|
||||
return false;
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
|
|
@ -6173,6 +6173,18 @@ private:
|
|||
" ASSERT(!(t4 < t5) && t4 <= t5);\n"
|
||||
"}";
|
||||
valueOfTok(code, "<=");
|
||||
|
||||
code = "void f() {\n"
|
||||
" unsigned short Xoff = 10;\n"
|
||||
" unsigned short Nx = 0;\n"
|
||||
" int last;\n"
|
||||
" do {\n"
|
||||
" last = readData(0);\n"
|
||||
" if (last && (last - Xoff < Nx))\n"
|
||||
" Nx = last - Xoff;\n"
|
||||
" } while (last > 0);\n"
|
||||
"}\n";
|
||||
valueOfTok(code, "last");
|
||||
}
|
||||
|
||||
void valueFlowHang() {
|
||||
|
|
Loading…
Reference in New Issue