From 6c9bcbc1d8c46c8e43e81c1b11fc9b3430f8256a Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 26 May 2026 13:23:32 +0200 Subject: [PATCH 1/3] Update vf_settokenvalue.cpp --- lib/vf_settokenvalue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/vf_settokenvalue.cpp b/lib/vf_settokenvalue.cpp index c5fe519b720..fe94225083b 100644 --- a/lib/vf_settokenvalue.cpp +++ b/lib/vf_settokenvalue.cpp @@ -291,9 +291,9 @@ namespace ValueFlow combineValueProperties(value1, value2, result); - if (Token::simpleMatch(parent, "==") && result.intvalue) + if (Token::simpleMatch(parent, "==") && result.intvalue && !(value1.intvalue == 0 && value2.intvalue == 0)) continue; - if (Token::simpleMatch(parent, "!=") && !result.intvalue) + if (Token::simpleMatch(parent, "!=") && !result.intvalue && !(value1.intvalue == 0 && value2.intvalue == 0)) continue; setTokenValue(parent, std::move(result), settings); From 719e66187566a635fce5463f3465a69d87370419 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 26 May 2026 13:24:30 +0200 Subject: [PATCH 2/3] Update testvalueflow.cpp --- test/testvalueflow.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index c879b9cffd5..3e10ffb9361 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -9225,6 +9225,19 @@ class TestValueFlow : public TestFixture { "}\n"; ASSERT_EQUALS(false, testValueOfX(code, 5U, 1)); ASSERT_EQUALS(false, testValueOfX(code, 5U, 0)); + + code = "bool f() {\n" + " std::string s1, s2;\n" + " bool x = (s1 == s2);\n" + " return x;\n" + "}\n" + "bool g() {\n" + " std::string s1, s2;\n" + " bool x = (s1 != s2);\n" + " return x;\n" + "}\n"; + ASSERT_EQUALS(true, testValueOfXKnown(code, 4U, 1)); + ASSERT_EQUALS(true, testValueOfXKnown(code, 9U, 0)); } void valueFlowBailoutIncompleteVar() { From fc7c183f929a62a6d1810410876d0b7a2c27c40a Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Tue, 26 May 2026 19:01:20 +0200 Subject: [PATCH 3/3] Trigger CI