Skip to content

Fix #14891 FP knownConditionTrueFalse (dereferencing pointer to array member)#8704

Open
chrchr-github wants to merge 2 commits into
cppcheck-opensource:mainfrom
chrchr-github:chr_14891
Open

Fix #14891 FP knownConditionTrueFalse (dereferencing pointer to array member)#8704
chrchr-github wants to merge 2 commits into
cppcheck-opensource:mainfrom
chrchr-github:chr_14891

Conversation

@chrchr-github

Copy link
Copy Markdown
Collaborator

No description provided.

@chrchr-github

chrchr-github commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator Author

@pfultz2 Please review, I'm not entirely sure this is the right fix.

@pfultz2

pfultz2 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Yea this is not the right fix. The correct fix should be in valueFlowSymbolic. There are a couple of issue here.

First const int* p = a should not create a symbolic value. We have checks in valueFlowSymbolic for different types and implicit conversions and it needs to be updated to skip for decaying arrays as well.

Secondly, the lifetime of p shows lifetime[Object]=(a) but it would be better if it was lifetime[Address]=(a). Its probably not necessary to fix for this FP, but its something I noticed with the valueflow output.

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