Skip to content

Add tests for #6092, #9995, #13766 - #9007

Merged
chrchr-github merged 3 commits into
cppcheck-opensource:mainfrom
chrchr-github:chr_test
Nov 9, 2026
Merged

chrchr-github merged 3 commits into
cppcheck-opensource:mainfrom
chrchr-github:chr_test

Conversation

@chrchr-github

Copy link
Copy Markdown
Collaborator

No description provided.

@chrchr-github chrchr-github changed the title Add tests for #6092, #13766 Add tests for #6092, #9995, #13766 Nov 9, 2026

@dmcppcheck dmcppcheck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review

This PR only adds regression tests: #6092 (array index out of bounds after a conditional i++), #9995 (unusedVariable false positive with a reference-member operator[]) and #13766 ((typename const U&) cast). I found no problems. All three new assertions pass against the PR build. Each expected message matches what the PR's cppcheck binary prints for the same code. The #6092 test also has no false positive in a variant where the index stays in bounds.

Testing

  • Built cppcheck and testrunner in pr/ with make -j8. The build succeeded.
  • Ran ./testrunner TestBufferOverrun TestOther TestUnusedVar: Tests failed: 0 (682 tests, 142 todos).
  • Ran pr/cppcheck --enable=all on the #6092 code, plus a variant where the array has 3 elements so the index stays in bounds:
    • The original code gives exactly the [7:11] arrayIndexOutOfBounds error that the test expects. The trace notes show the path through the if (b) branch.
    • The 3-element variant gives no out-of-bounds error, as expected.

Automated review of dfa2a4a by Claude. The pull request was built and tested locally.

@chrchr-github
chrchr-github merged commit bf89a6f into cppcheck-opensource:main Nov 9, 2026
90 of 91 checks passed
@chrchr-github
chrchr-github deleted the chr_test branch November 9, 2026 14:29
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