From 9549ab630bf6fcba5ce77f83af98b4abfdb679fa Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:07:21 +0200 Subject: [PATCH 1/2] Update vf_analyzers.cpp --- lib/vf_analyzers.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/vf_analyzers.cpp b/lib/vf_analyzers.cpp index cfba7d5f970..6ebd5adf9f7 100644 --- a/lib/vf_analyzers.cpp +++ b/lib/vf_analyzers.cpp @@ -616,6 +616,8 @@ struct ValueFlowAnalyzer : Analyzer { return Action::None; Action la = analyzeLifetime(lifeTok); if (la.matches()) { + if (tok->isUnaryOp("*") && tok->valueType() && lifeTok->valueType() && tok->valueType()->pointer < lifeTok->valueType()->pointer) + return Action::Invalid; Action a = Action::Read; if (isModified(tok).isModified()) a = Action::Invalid; From 232bbf4a8055581341b2cf6e3fb417759f37fb15 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 7 Jul 2026 16:08:47 +0200 Subject: [PATCH 2/2] Update testvalueflow.cpp --- test/testvalueflow.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 888710ce57d..886d1058190 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -9092,6 +9092,15 @@ class TestValueFlow : public TestFixture { " return x;\n" "}\n"; ASSERT_EQUALS(false, testValueOfX(code, 3U, "malloc(10)", 0)); + + code = "struct S {\n" // #14891 + " void f() const {\n" + " const int* p = a;\n" + " if (*p) {}\n" + " }\n" + " int a[3];\n" + "};\n"; + ASSERT(tokenValues(code, "* p )").empty()); } void valueFlowSymbolicIdentity()