This commit is contained in:
parent
1135520aa8
commit
3329e2f633
|
@ -6304,7 +6304,7 @@ struct ConditionHandler {
|
|||
values.insert(values.end(), cond.false_values.cbegin(), cond.false_values.cend());
|
||||
|
||||
// extra logic for unsigned variables 'i>=1' => possible value can also be 0
|
||||
if (Token::Match(tok, "<|>")) {
|
||||
if (Token::Match(tok, "<|>|<=|>=")) {
|
||||
values.remove_if([](const ValueFlow::Value& v) {
|
||||
if (v.isIntValue())
|
||||
return v.intvalue != 0;
|
||||
|
|
|
@ -4547,6 +4547,14 @@ private:
|
|||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
check("int f(int i) {\n" // #11741
|
||||
" i = -i - 1;\n"
|
||||
" if (i < 0 || i >= 20)\n"
|
||||
" return 0;\n"
|
||||
" return 1;\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void alwaysTrueSymbolic()
|
||||
|
|
|
@ -1460,7 +1460,7 @@ private:
|
|||
" int a = x;\n"
|
||||
" if (x >= 1) {}\n"
|
||||
"}";
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 2U, 1));
|
||||
TODO_ASSERT_EQUALS(true, false, testValueOfX(code, 2U, 1));
|
||||
ASSERT_EQUALS(true, testValueOfX(code, 2U, 0));
|
||||
|
||||
code = "void f(unsigned int x) {\n"
|
||||
|
|
Loading…
Reference in New Issue