Skip to content

Fix #13522 FP knownConditionTrueFalse after unsigned-to-signed conversion#7179

Merged
chrchr-github merged 1 commit into
cppcheck-opensource:mainfrom
chrchr-github:chr_13522
Feb 23, 2025
Merged

Fix #13522 FP knownConditionTrueFalse after unsigned-to-signed conversion#7179
chrchr-github merged 1 commit into
cppcheck-opensource:mainfrom
chrchr-github:chr_13522

Conversation

@chrchr-github

Copy link
Copy Markdown
Collaborator

No description provided.

@chrchr-github

Copy link
Copy Markdown
Collaborator Author

@pfultz2 Any thoughts?

@danmar danmar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I agree it's a false positive however if the fix is correct, I don't know..

Comment thread lib/vf_analyzers.cpp
continue;
if (exact && v.intvalue != 0 && !isPoint)
continue;
if (astIsUnsigned(tok) != astIsUnsigned(v.tokvalue))

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.

This is fine, it is a little too restrictive which could lead to FNs, but it will fix FPs. To fix FNs, we would need to check if the value is within the range of an unsigned value. I am not sure how to write a test case to demonstrate it though as most known values will be passed through with the afterAssign passes anyways. Need to think about it some more.

@chrchr-github chrchr-github Jan 7, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

👍 We could also wait until after the next release, so we can see the effects in daca.

@firewave firewave added the merge-after-next-release Wait with merging this PR until after the next Release label Jan 28, 2025
@chrchr-github chrchr-github merged commit 80047b5 into cppcheck-opensource:main Feb 23, 2025
@chrchr-github chrchr-github deleted the chr_13522 branch February 23, 2025 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-after-next-release Wait with merging this PR until after the next Release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants