From 1dfc99f286398a340a38459d7721ca10c3ed4d48 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 11 May 2026 09:59:49 +0200 Subject: [PATCH 1/2] Update programmemory.h --- lib/programmemory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/programmemory.h b/lib/programmemory.h index bb68a9404d4..95effc70874 100644 --- a/lib/programmemory.h +++ b/lib/programmemory.h @@ -102,7 +102,7 @@ struct ExprIdToken { }; struct CPPCHECKLIB ProgramMemory { - using Map = std::unordered_map; + using Map = std::map; ProgramMemory() : mValues(new Map()) {} From e992e9b3c00952558287dce2e9f58d067fe1897a Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Mon, 11 May 2026 10:01:03 +0200 Subject: [PATCH 2/2] Update testcondition.cpp --- test/testcondition.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testcondition.cpp b/test/testcondition.cpp index fae9c8fce13..f0764dd2bd6 100644 --- a/test/testcondition.cpp +++ b/test/testcondition.cpp @@ -5174,6 +5174,15 @@ class TestCondition : public TestFixture { TODO_ASSERT_EQUALS("", "[test.cpp:11:14]: (style) Condition 'p->i==o' is always true [knownConditionTrueFalse]\n", errout_str()); + + check("void f(int x) {\n" // #12320 + " int a = 0, b = 0, c = 0;\n" + " a = x;\n" + " if (a) b = x;\n" + " if (b) c = x;\n" + " if (c) {}\n" + "}\n"); + ASSERT_EQUALS("", errout_str()); } void alwaysTrueInfer() {