File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -148,7 +148,7 @@ struct Interval {
148148 result.setMinValue (minValue->intvalue + 1 , minValue);
149149 if (minValue->isPossible () && minValue->bound == ValueFlow::Value::Bound::Lower)
150150 result.setMinValue (minValue->intvalue , minValue);
151- if (!minValue->isImpossible () && minValue->bound == ValueFlow::Value::Bound::Point &&
151+ if (!minValue->isImpossible () && ( minValue->bound == ValueFlow::Value::Bound::Point || minValue-> isKnown ()) &&
152152 std::count_if (values.begin (), values.end (), predicate) == 1 )
153153 return Interval::fromInt (minValue->intvalue , minValue);
154154 }
Original file line number Diff line number Diff line change @@ -7183,6 +7183,17 @@ class TestValueFlow : public TestFixture {
71837183 " a;\n "
71847184 " }\n " ;
71857185 valueOfTok (code, " a" );
7186+
7187+ code = " void f(int i, int j, int n) {\n "
7188+ " if ((j == 0) != (i == 0)) {}\n "
7189+ " int t = 0;\n "
7190+ " if (j > 0) {\n "
7191+ " t = 1;\n "
7192+ " if (n < j)\n "
7193+ " n = j;\n "
7194+ " }\n "
7195+ " }\n " ;
7196+ valueOfTok (code, " i" );
71867197 }
71877198
71887199 void valueFlowCrashConstructorInitialization () { // #9577
You can’t perform that action at this time.
0 commit comments