From 1a8ebb286d6ea474eceade0c2841e47d0b0a181d Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 5 Mar 2026 16:57:34 +0100 Subject: [PATCH 1/5] Update astutils.cpp --- lib/astutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 2d53ef0b0c1..9864b918352 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -1084,7 +1084,7 @@ bool isAliasOf(const Token* tok, const Token* expr, nonneg int* indirect) r = findAstNode(expr, [&](const Token* childTok) { if (childTok->exprId() == 0) return false; - if (ref.token != tok && expr->exprId() == childTok->exprId()) { + if (ref.token != tok && expr->exprId() == childTok->exprId() && ref.token->astOperand1() && expr->exprId() == ref.token->astOperand1()->exprId()) { if (indirect) *indirect = 0; return true; From a61e586a5a1ba4bf670f8543da0ac9e46727f647 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 5 Mar 2026 16:58:33 +0100 Subject: [PATCH 2/5] Update testother.cpp --- test/testother.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/testother.cpp b/test/testother.cpp index 53f14c2a31d..86d3dee2786 100644 --- a/test/testother.cpp +++ b/test/testother.cpp @@ -4749,6 +4749,18 @@ class TestOther : public TestFixture { " return [](int* p) { return *p; }(&i);\n" "}\n"); ASSERT_EQUALS("[test.cpp:3:20]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str()); + + check("struct S {\n" // #14571 + " char* c;\n" + "};\n" + "struct T {\n" + " S s;\n" + "};\n" + "void f(std::string* p, T& t) {\n" + " S& r = t.s;\n" + " strcpy(r.c, p->c_str());\n" + "}\n"); + ASSERT_EQUALS("[test.cpp:7:21]: (style) Parameter 'p' can be declared as pointer to const [constParameterPointer]\n", errout_str()); } void constArray() { From c53942b14620ca70d1a5e889e103a95d12767d2a Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:32:34 +0100 Subject: [PATCH 3/5] Update astutils.cpp --- lib/astutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 9864b918352..206d35cfaee 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -1084,7 +1084,7 @@ bool isAliasOf(const Token* tok, const Token* expr, nonneg int* indirect) r = findAstNode(expr, [&](const Token* childTok) { if (childTok->exprId() == 0) return false; - if (ref.token != tok && expr->exprId() == childTok->exprId() && ref.token->astOperand1() && expr->exprId() == ref.token->astOperand1()->exprId()) { + if (ref.token != tok && expr->exprId() == childTok->exprId() && ref.token->isUnaryOperand("*") && expr->exprId() == ref.token->astOperand1()->exprId()) { if (indirect) *indirect = 0; return true; From 264cdafc5981341e51be119c86f4a4fdbbfdd565 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 5 Mar 2026 19:43:24 +0100 Subject: [PATCH 4/5] Update astutils.cpp --- lib/astutils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/astutils.cpp b/lib/astutils.cpp index 206d35cfaee..e1a47f22b3c 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -1084,7 +1084,7 @@ bool isAliasOf(const Token* tok, const Token* expr, nonneg int* indirect) r = findAstNode(expr, [&](const Token* childTok) { if (childTok->exprId() == 0) return false; - if (ref.token != tok && expr->exprId() == childTok->exprId() && ref.token->isUnaryOperand("*") && expr->exprId() == ref.token->astOperand1()->exprId()) { + if (ref.token != tok && expr->exprId() == childTok->exprId() && ref.token->isUnaryOp("*") && expr->exprId() == ref.token->astOperand1()->exprId()) { if (indirect) *indirect = 0; return true; From 69ac8f284ec57d044d21fe8e06d375c2d9a7da84 Mon Sep 17 00:00:00 2001 From: chrchr-github Date: Thu, 5 Mar 2026 21:03:07 +0100 Subject: [PATCH 5/5] const, suppress --- cli/signalhandler.cpp | 2 +- lib/valueflow.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/signalhandler.cpp b/cli/signalhandler.cpp index c87822454ae..88864efd743 100644 --- a/cli/signalhandler.cpp +++ b/cli/signalhandler.cpp @@ -108,7 +108,7 @@ static const Signalmap_t listofsignals = { * but when ending up here something went terribly wrong anyway. * And all which is left is just printing some information and terminate. */ -static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context) +static void CppcheckSignalHandler(int signo, siginfo_t * info, void * context) // cppcheck-suppress constParameterCallback - info can be const { int type = -1; pid_t killid; diff --git a/lib/valueflow.cpp b/lib/valueflow.cpp index bf732566fff..f7e057da58f 100644 --- a/lib/valueflow.cpp +++ b/lib/valueflow.cpp @@ -4101,7 +4101,7 @@ static bool intersects(const C1& c1, const C2& c2) return false; } -static void valueFlowAfterAssign(TokenList &tokenlist, +static void valueFlowAfterAssign(const TokenList &tokenlist, const SymbolDatabase& symboldatabase, ErrorLogger &errorLogger, const Settings &settings,