Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chrchr-github
Copy link
Collaborator

No description provided.

@chrchr-github
Copy link
Collaborator Author

@pfultz2 Any thoughts?

Copy link
Owner

@danmar danmar left a comment

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..

@@ -527,6 +527,8 @@ struct ValueFlowAnalyzer : Analyzer {
continue;
if (exact && v.intvalue != 0 && !isPoint)
continue;
if (astIsUnsigned(tok) != astIsUnsigned(v.tokvalue))
Copy link
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.

Copy link
Collaborator Author

@chrchr-github chrchr-github Jan 7, 2025

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.

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.

3 participants