File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -528,6 +528,8 @@ struct ValueFlowAnalyzer : Analyzer {
528
528
continue ;
529
529
if (exact && v.intvalue != 0 && !isPoint)
530
530
continue ;
531
+ if (astIsUnsigned (tok) != astIsUnsigned (v.tokvalue ))
532
+ continue ;
531
533
std::vector<MathLib::bigint> r;
532
534
ValueFlow::Value::Bound bound = currValue->bound ;
533
535
if (match (v.tokvalue )) {
Original file line number Diff line number Diff line change @@ -4968,6 +4968,13 @@ class TestCondition : public TestFixture {
4968
4968
" }\n "
4969
4969
" }\n " );
4970
4970
ASSERT_EQUALS (" " , errout_str ());
4971
+
4972
+ check (" void f(unsigned x) {\n " // #13522
4973
+ " unsigned u = x;\n "
4974
+ " int i = u - 0;\n "
4975
+ " if (i < 0) {}\n "
4976
+ " }\n " );
4977
+ ASSERT_EQUALS (" " , errout_str ());
4971
4978
}
4972
4979
4973
4980
void alwaysTrueInfer () {
You can’t perform that action at this time.
0 commit comments