Skip to content

Fix #15316 (ValueFlow: skip functions without new values in the next iteration) - #9121

Open
danmar wants to merge 1 commit into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-15316
Open

danmar wants to merge 1 commit into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-15316

Conversation

@danmar

@danmar danmar commented Dec 4, 2026 •

Copy link
Copy Markdown
Collaborator

The iterated ValueFlow passes are run again for all functions until no new values are found. A function where no value changed in the previous iteration will not get new values from the intra-function passes, so skip it.

The purpose of this was to optimise Cppcheck.

Running the passes again on an unchanged function can add a possible value to a comparison, which then keeps a known value from being set later. In 10000 Debian packages (--check-level=exhaustive) this adds 16 correct knownConditionTrueFalse warnings and loses none.

The iterated ValueFlow passes are run again for all functions until no
new values are found. A function where no value changed in the previous
iteration will not get new values from the intra-function passes, so
skip it.

Running the passes again on an unchanged function can add a possible
value to a comparison, which then keeps a known value from being set
later. In 10000 Debian packages (--check-level=exhaustive) this adds 16
correct knownConditionTrueFalse warnings and loses none.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dmcppcheck

Copy link
Copy Markdown
Contributor

Tests may be missing

@dmcppcheck

Copy link
Copy Markdown
Contributor

There should probably be a trac ticket for this PR. Please create it, or ask us to create it. Then the PR title should be updated.

@danmar danmar changed the title ValueFlow: skip functions without new values in the next iteration Fix #15316 (ValueFlow: skip functions without new values in the next iteration) Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants