From 129dba1c0d467d2d4764a4f0fce2957c64269579 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 23 Jul 2026 17:21:49 +0200 Subject: [PATCH 1/4] Update valueflow.cpp --- lib/valueflow.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index 096e3d56f56..1b5c0508162 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -1107,19 +1107,6 @@ static void valueFlowImpossibleValues(TokenList& tokenList, const Settings& sett for (const Token* tok2 : tokens) { if (const ValueFlow::Value* v = tok2->getKnownValue(ValueFlow::Value::ValueType::INT)) { values.emplace_back(*v); - } else { - ValueFlow::Value symValue{}; - symValue.valueType = ValueFlow::Value::ValueType::SYMBOLIC; - symValue.tokvalue = tok2; - values.push_back(std::move(symValue)); - std::copy_if(tok2->values().cbegin(), - tok2->values().cend(), - std::back_inserter(values), - [](const ValueFlow::Value& v) { - if (!v.isKnown()) - return false; - return v.isSymbolicValue(); - }); } } const bool isMin = Token::Match(condTok, "<|<=") ^ flipped; From 2145c4afc9a9ca4208ef088b7b71eb6721e10aa5 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 23 Jul 2026 17:23:19 +0200 Subject: [PATCH 2/4] Update testvalueflow.cpp --- test/testvalueflow.cpp | 61 ------------------------------------------ 1 file changed, 61 deletions(-) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index abeb603b660..44c660fb39b 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -9334,67 +9334,6 @@ class TestValueFlow : public TestFixture { ASSERT_EQUALS(false, testValueOfX(code, 5U, 0)); } - void valueFlowImpossibleMinMax() - { - const char* code; - - code = "void f(int a, int b) {\n" - " int x = a < b ? a : b;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", 1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "b", 1)); - - code = "void f(int a, int b) {\n" - " int x = a > b ? a : b;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", -1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "b", -1)); - - code = "void f(int a, int b) {\n" - " int x = a > b ? b : a;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", 1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "b", 1)); - - code = "void f(int a, int b) {\n" - " int x = a < b ? b : a;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", -1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "b", -1)); - - code = "void f(int a) {\n" - " int x = a < 0 ? a : 0;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", 1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, 1)); - - code = "void f(int a) {\n" - " int x = a > 0 ? a : 0;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", -1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, -1)); - - code = "void f(int a) {\n" - " int x = a > 0 ? 0 : a;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", 1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, 1)); - - code = "void f(int a) {\n" - " int x = a < 0 ? 0 : a;\n" - " return x;\n" - "}\n"; - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, "a", -1)); - ASSERT_EQUALS(true, testValueOfXImpossible(code, 3U, -1)); - } - void valueFlowImpossibleIncDec() { const char* code; From 27cbb8c13b4c42492afcbc0086b933ad48c4119e Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 23 Jul 2026 17:29:30 +0200 Subject: [PATCH 3/4] Update testcondition.cpp --- test/testcondition.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index da4ecae43b3..8c1779cf106 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -5222,6 +5222,12 @@ class TestCondition : public TestFixture { " if (c) {}\n" "}\n"); ASSERT_EQUALS("", errout_str()); + + check("void f(int a, int b) {\n" // #11437 + " a = a < b ? b : a;\n" + " if (a != b) {}\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); } void alwaysTrueInfer() { From 4daa356c74426ded9a9a5d5699e094ad5320ca44 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 23 Jul 2026 17:39:25 +0200 Subject: [PATCH 4/4] Update testvalueflow.cpp --- test/testvalueflow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 44c660fb39b..1451de322ea 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -166,7 +166,6 @@ class TestValueFlow : public TestFixture { TEST_CASE(valueFlowSymbolicIdentity); TEST_CASE(valueFlowSymbolicStrlen); TEST_CASE(valueFlowSmartPointer); - TEST_CASE(valueFlowImpossibleMinMax); TEST_CASE(valueFlowImpossibleIncDec); TEST_CASE(valueFlowImpossibleUnknownConstant); TEST_CASE(valueFlowContainerEqual);