From 35046148594b5901efb7283a0cb6c39f916e5a02 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 21 Oct 2025 13:13:53 +0200 Subject: [PATCH 1/2] 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 421ab3fc996..f76e512a3b9 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -2203,7 +2203,7 @@ static bool hasNoreturnFunction(const Token* tok, const Library& library, const { if (!tok) return false; - const Token* ftok = tok->str() == "(" ? tok->previous() : nullptr; + const Token* ftok = (tok->str() == "(" && !tok->isCast()) ? tok->previous() : nullptr; while (Token::simpleMatch(ftok, "(")) ftok = ftok->astOperand1(); if (ftok) { From 3306a0eb62999df386508c5326bdb46dacbdc285 Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Tue, 21 Oct 2025 13:16:53 +0200 Subject: [PATCH 2/2] Update testvalueflow.cpp --- test/testvalueflow.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/testvalueflow.cpp b/test/testvalueflow.cpp index 5046f88c560..0285e2dea2b 100644 --- a/test/testvalueflow.cpp +++ b/test/testvalueflow.cpp @@ -172,6 +172,7 @@ class TestValueFlow : public TestFixture { mNewTemplate = false; TEST_CASE(valueFlowBailoutIncompleteVar); + TEST_CASE(valueFlowBailoutNoreturn); mNewTemplate = true; TEST_CASE(performanceIfCount); @@ -9077,6 +9078,16 @@ class TestValueFlow : public TestFixture { errout_str()); } + void valueFlowBailoutNoreturn() { // #13718 + bailout( + "void f(const int* p) {\n" + " if (p)\n" + " (void)*p;\n" + "}\n" + ); + ASSERT_EQUALS_WITHOUT_LINENUMBERS("", errout_str()); + } + void performanceIfCount() { /*const*/ Settings s(settings); s.vfOptions.maxIfCount = 1;